浏览代码

Show help banner if no command given

Aanand Prasad 12 年之前
父节点
当前提交
3bebd18de7
共有 1 个文件被更改,包括 3 次插入0 次删除
  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())
         options = docopt_full_help(getdoc(self), argv, **self.docopt_options())
         command = options['COMMAND']
         command = options['COMMAND']
 
 
+        if command is None:
+            raise SystemExit(getdoc(self))
+
         if not hasattr(self, command):
         if not hasattr(self, command):
             raise NoSuchCommand(command, self)
             raise NoSuchCommand(command, self)