コード例 #1
0
ファイル: ftp-cmd.py プロジェクト: holajiawei/bup
def inputiter():
    if os.isatty(stdin.fileno()):
        while 1:
            try:
                yield _helpers.readline(b'bup> ')
            except EOFError:
                print()  # Clear the line for the terminal's next prompt
                break
    else:
        for line in stdin:
            yield line
コード例 #2
0
ファイル: ftp-cmd.py プロジェクト: zeonin/bup
def inputiter():
    if os.isatty(stdin.fileno()):
        while 1:
            if hasattr(_helpers, 'readline'):
                try:
                    yield _helpers.readline(b'bup> ')
                except EOFError:
                    print()  # Clear the line for the terminal's next prompt
                    break
            else:
                out.write(b'bup> ')
                out.flush()
                read_line = stdin.readline()
                if not read_line:
                    print('')
                    break
                yield read_line
    else:
        for line in stdin:
            yield line
コード例 #3
0
ファイル: ftp.py プロジェクト: jmberg/bup
 def inputiter(f):
     if os.isatty(f.fileno()):
         while 1:
             prompt = b'bup %s> ' % (b'/'.join(name for name, item in pwd) or b'/', )
             if hasattr(_helpers, 'readline'):
                 try:
                     yield _helpers.readline(prompt)
                 except EOFError:
                     print()  # Clear the line for the terminal's next prompt
                     break
             else:
                 out.write(prompt)
                 out.flush()
                 read_line = f.readline()
                 if not read_line:
                     print('')
                     break
                 yield read_line
     else:
         for line in f:
             yield line