changeset 61:64f37c4cce68

Print the help by default when running `chef` with no command.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 27 Aug 2014 10:23:32 -0700
parents 6e60e0fef2be
children 52e4d9a1f917
files piecrust/main.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/main.py	Tue Aug 26 23:20:48 2014 -0700
+++ b/piecrust/main.py	Wed Aug 27 10:23:32 2014 -0700
@@ -179,6 +179,11 @@
     result = parser.parse_args()
     logger.debug(format_timed(start_time, 'initialized PieCrust', colored=False))
 
+    # Print the help if no command was specified.
+    if not hasattr(result, 'func'):
+        parser.print_help()
+        return 0
+
     # Run the command!
     ctx = CommandContext(app, parser, result)
     exit_code = result.func(ctx)