From 85845414b8c43458a09c834aa64c2944189c2529 Mon Sep 17 00:00:00 2001 From: Kay Kurokawa Date: Mon, 20 Mar 2017 13:41:32 -0400 Subject: [PATCH] format help message properly in case of error in CLI --- lbrynet/lbrynet_daemon/DaemonCLI.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lbrynet/lbrynet_daemon/DaemonCLI.py b/lbrynet/lbrynet_daemon/DaemonCLI.py index 18b7682bd..fd3bd9ad4 100644 --- a/lbrynet/lbrynet_daemon/DaemonCLI.py +++ b/lbrynet/lbrynet_daemon/DaemonCLI.py @@ -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: