summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2013-10-23 18:46:34 -0400
committerDoug Hellmann <doug.hellmann@dreamhost.com>2013-10-23 18:49:18 -0400
commit8077b6f1c8bb7e6ca7fa619d609947704603b62e (patch)
tree89b2f05c5ee3b9612fe4cf8a5a985004fd1b2917
parent28898d675df4a205fd11395e28c7c53e504de7b2 (diff)
downloadcliff-8077b6f1c8bb7e6ca7fa619d609947704603b62e.tar.gz
Enable debug in help mode
Look for the debug flag when running the help command and log more details. Change-Id: Idbf294f9a63da650758cab175a24cfa65d482a68
-rw-r--r--cliff/help.py5
1 files changed, 5 insertions, 0 deletions
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))