Merge pull request #546 from lbryio/fix_cli_error_msg
format help message properly in case of error in CLI
This commit is contained in:
commit
3d606b95aa
1 changed files with 5 additions and 3 deletions
|
@ -64,8 +64,7 @@ def main():
|
|||
os.path.basename(sys.argv[0]))
|
||||
)
|
||||
else:
|
||||
help_response = api.call('help', params)
|
||||
print help_response['help'] if 'help' in help_response else help_response
|
||||
print_help_response(api.call('help', params))
|
||||
|
||||
elif method not in api.commands():
|
||||
print_error("'" + method + "' is not a valid command.")
|
||||
|
@ -84,13 +83,16 @@ def main():
|
|||
# instead of this generic message.
|
||||
# https://app.asana.com/0/158602294500137/200173944358192
|
||||
print "Something went wrong, here's the usage for %s:" % method
|
||||
print api.call('help', {'command': method})
|
||||
print_help_response(api.call('help', {'command': method}))
|
||||
if hasattr(err, 'msg'):
|
||||
print "Here's the traceback for the error you encountered:"
|
||||
print err.msg
|
||||
return 1
|
||||
|
||||
|
||||
def print_help_response(help_response):
|
||||
print help_response['help'] if 'help' in help_response else help_response
|
||||
|
||||
def guess_type(x):
|
||||
if '.' in x:
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue