From df2d50925e5cd3655d6e4dd39ebc6bdefa69a359 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 1 Jan 2021 20:34:21 +0800 Subject: [PATCH] ceph.in: remove unused indent no need to put `if True`. it was used when removing unused variables. but it'd be better to have less indent for better readability. Signed-off-by: Kefu Chai --- src/ceph.in | 79 ++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index 7b21a53ab9a..b92161586d2 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -626,47 +626,46 @@ def new_style_command(parsed_args, sig = cmd['sig'] print('{0}: {1}'.format(cmdtag, concise_sig(sig))) - if True: - if cmdargs: - # Non interactive mode - ret, outbuf, outs = do_command(parsed_args, target, cmdargs, sigdict, inbuf, verbose) - else: - # Interactive mode (ceph cli) - if sys.stdin.isatty(): - # do the command-interpreter looping - # for input to do readline cmd editing - import readline # noqa + if cmdargs: + # Non interactive mode + ret, outbuf, outs = do_command(parsed_args, target, cmdargs, sigdict, inbuf, verbose) + else: + # Interactive mode (ceph cli) + if sys.stdin.isatty(): + # do the command-interpreter looping + # for input to do readline cmd editing + import readline # noqa - while True: - try: - interactive_input = read_input() - except EOFError: - # leave user an uncluttered prompt - return 0, b'\n', '' - if interactive_input is None: - return 0, b'', '' - cmdargs = parse_cmdargs(shlex.split(interactive_input))[2] - try: - target = find_cmd_target(cmdargs) - except Exception as e: - print('error handling command target: {0}'.format(e), - file=sys.stderr) - continue - if len(cmdargs) and cmdargs[0] == 'tell': - print('Can not use \'tell\' in interactive mode.', - file=sys.stderr) - continue - ret, outbuf, outs = do_command(parsed_args, target, cmdargs, - sigdict, inbuf, verbose) - if ret < 0: - ret = -ret - errstr = errno.errorcode.get(ret, 'Unknown') - print('Error {0}: {1}'.format(errstr, outs), file=sys.stderr) - else: - if outs: - print(outs, file=sys.stderr) - if outbuf: - print(outbuf.decode('utf-8')) + while True: + try: + interactive_input = read_input() + except EOFError: + # leave user an uncluttered prompt + return 0, b'\n', '' + if interactive_input is None: + return 0, b'', '' + cmdargs = parse_cmdargs(shlex.split(interactive_input))[2] + try: + target = find_cmd_target(cmdargs) + except Exception as e: + print('error handling command target: {0}'.format(e), + file=sys.stderr) + continue + if len(cmdargs) and cmdargs[0] == 'tell': + print('Can not use \'tell\' in interactive mode.', + file=sys.stderr) + continue + ret, outbuf, outs = do_command(parsed_args, target, cmdargs, + sigdict, inbuf, verbose) + if ret < 0: + ret = -ret + errstr = errno.errorcode.get(ret, 'Unknown') + print('Error {0}: {1}'.format(errstr, outs), file=sys.stderr) + else: + if outs: + print(outs, file=sys.stderr) + if outbuf: + print(outbuf.decode('utf-8')) return ret, outbuf, outs -- 2.39.5