From 8077b6f1c8bb7e6ca7fa619d609947704603b62e Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 23 Oct 2013 18:46:34 -0400 Subject: Enable debug in help mode Look for the debug flag when running the help command and log more details. Change-Id: Idbf294f9a63da650758cab175a24cfa65d482a68 --- cliff/help.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cliff/help.py b/cliff/help.py index eb007f1..9d96111 100644 --- a/cliff/help.py +++ b/cliff/help.py @@ -1,5 +1,6 @@ import argparse import sys +import traceback from .command import Command @@ -21,11 +22,15 @@ class HelpAction(argparse.Action): factory = ep.load() except Exception as err: app.stdout.write('Could not load %r\n' % ep) + if namespace.debug: + traceback.print_exc(file=app.stdout) continue try: cmd = factory(app, None) except Exception as err: app.stdout.write('Could not instantiate %r: %s\n' % (ep, err)) + if namespace.debug: + traceback.print_exc(file=app.stdout) continue one_liner = cmd.get_description().split('\n')[0] app.stdout.write(' %-13s %s\n' % (name, one_liner)) -- cgit v1.2.1