Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pybind/ceph_argparse: fix cli output info #17667

Merged
merged 1 commit into from Sep 15, 2017

Conversation

Projects
None yet
4 participants
@scienceluo
Copy link
Contributor

commented Sep 12, 2017

Fix cli output info.

Before:

[root@host_191 ~]# ceph osd st
no valid command found; 10 closest matches:
osd stat
osd status {<bucket>}
Error EINVAL: invalid command

After:

[root@host_191 ~]# ceph osd st
no valid command found; 2 closest matches:
osd stat
osd status {<bucket>}
Error EINVAL: invalid command

Signed-off-by: Luo Kexue luo.kexue@zte.com.cn

@@ -1073,7 +1073,7 @@ def validate_command(sigdict, args, verbose=False):
break

if not found:
print('no valid command found; 10 closest matches:', file=sys.stderr)
print('no valid command found; %d closest matches:'%min(len(bestcmds),10), file=sys.stderr)

This comment has been minimized.

Copy link
@liuchang0812

liuchang0812 Sep 12, 2017

Contributor

Keeping the style consistent would be better. how about:

print('no valid command found; {0} closest matches:'.format(min(len(bestcmds), 10)), file=sys.stderr)

This comment has been minimized.

Copy link
@scienceluo

scienceluo Sep 12, 2017

Author Contributor

Ok, fair enough. Thanks for your review @liuchang0812

@scienceluo scienceluo force-pushed the scienceluo:wip-luo-fix-cli-output-branch branch from 2ac6643 to b621d7f Sep 12, 2017

@@ -1073,7 +1073,7 @@ def validate_command(sigdict, args, verbose=False):
break

if not found:
print('no valid command found; 10 closest matches:', file=sys.stderr)
print('no valid command found; {0} closest matches:'.format(min(len(bestcmds), 10)), file=sys.stderr)

This comment has been minimized.

Copy link
@tchaikov

tchaikov Sep 12, 2017

Contributor

to avoid repeating 10 here. we can also:

bestcmds = bestcmds[:10]
print('no valid command found; {0} closest matches:'.format(len(bestcmds), file=sys.stderr)
for cmdsig in bestcmds:
  # ...

This comment has been minimized.

Copy link
@scienceluo

scienceluo Sep 13, 2017

Author Contributor

Sounds good. Thanks for your review and advice @tchaikov

@scienceluo scienceluo force-pushed the scienceluo:wip-luo-fix-cli-output-branch branch from b621d7f to 3a1ea8d Sep 13, 2017

pybind/ceph_argparse: fix cli output info
Signed-off-by: Luo Kexue <luo.kexue@zte.com.cn>

@tchaikov tchaikov merged commit 1c47369 into ceph:master Sep 15, 2017

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details

@scienceluo scienceluo deleted the scienceluo:wip-luo-fix-cli-output-branch branch Sep 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.