diff options
Diffstat (limited to 'heatclient/shell.py')
-rw-r--r-- | heatclient/shell.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/heatclient/shell.py b/heatclient/shell.py index 82b05df..9d136a6 100644 --- a/heatclient/shell.py +++ b/heatclient/shell.py @@ -421,12 +421,17 @@ class HelpFormatter(argparse.HelpFormatter): super(HelpFormatter, self).start_section(heading) -def main(): +def main(args=None): try: - HeatShell().main(sys.argv[1:]) + if args is None: + args = sys.argv[1:] + HeatShell().main(args) except Exception as e: - print(strutils.safe_encode(six.text_type(e)), file=sys.stderr) + if '--debug' in args or '-d' in args: + raise + else: + print(strutils.safe_encode(six.text_type(e)), file=sys.stderr) sys.exit(1) if __name__ == "__main__": |