diff options
author | Dan Mick <dan.mick@inktank.com> | 2013-06-13 17:38:26 -0700 |
---|---|---|
committer | Dan Mick <dan.mick@inktank.com> | 2013-06-13 17:38:26 -0700 |
commit | 821b203c4e99441ab7aab512f6d5a44b719c96cb (patch) | |
tree | c17e705feb185048d5e15e14779c25d1b8115ab4 | |
parent | 763432a3ccfee7fdbc4686356164dab1680e354d (diff) | |
download | ceph-821b203c4e99441ab7aab512f6d5a44b719c96cb.tar.gz |
ceph.in: less verbosity on error
Only show 'did you mean?' when in verbose mode
Only show first ten closest matches on error
Signed-off-by: Dan Mick <dan.mick@inktank.com>
-rwxr-xr-x | src/ceph.in | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ceph.in b/src/ceph.in index 7d6c62a7303..17308d26a5d 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -1080,18 +1080,18 @@ def validate_command(parsed_args, sigdict, args): pass except ArgumentError as e: # prefixes matched, but some other arg didn't; - # this is interesting information - print >> sys.stderr, '{0}: invalid command'.\ - format(' '.join(args)) - print >> sys.stderr, '{0}'.format(e) - print >> sys.stderr, "did you mean {0}?\n\t{1}".\ - format(concise_sig(sig), helptext) + # this is interesting information if verbose + if verbose: + print >> sys.stderr, '{0}: invalid command'.\ + format(' '.join(args)) + print >> sys.stderr, '{0}'.format(e) + print >> sys.stderr, "did you mean {0}?\n\t{1}".\ + format(concise_sig(sig), helptext) pass if not found: - print >> sys.stderr, 'no valid command found' - print >> sys.stderr, 'close matches:' - for cmdsig in bestcmds: + print >> sys.stderr, 'no valid command found; 10 closest matches:' + for cmdsig in bestcmds[:10]: for (cmdtag, cmd) in cmdsig.iteritems(): print >> sys.stderr, concise_sig(cmd['sig']) return None |