Explorar o código

Show help banner if no command given

Aanand Prasad %!s(int64=12) %!d(string=hai) anos
pai
achega
3bebd18de7
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      plum/cli/docopt_command.py

+ 3 - 0
plum/cli/docopt_command.py

@@ -28,6 +28,9 @@ class DocoptCommand(object):
         options = docopt_full_help(getdoc(self), argv, **self.docopt_options())
         command = options['COMMAND']
 
+        if command is None:
+            raise SystemExit(getdoc(self))
+
         if not hasattr(self, command):
             raise NoSuchCommand(command, self)