Browse Source

fix: Ignore commands in CLI docs that don't include help text

Matt Robenolt 7 years ago
parent
commit
cbc78e0e6b
1 changed files with 12 additions and 2 deletions
  1. 12 2
      bin/dump-command-help

+ 12 - 2
bin/dump-command-help

@@ -71,7 +71,13 @@ def write_page(out, data):
             f.write('%s\n' % line.encode('utf-8'))
 
 
+class NoHelp(Exception):
+    pass
+
+
 def dump_command(out, cmd, path):
+    if cmd.help is None:
+        raise NoHelp
     data = {
         'path': path,
         'help': cmd.help.replace('\b', ''),
@@ -99,8 +105,12 @@ def dump_command(out, cmd, path):
 
     if isinstance(cmd, click.Group):
         for child_name, child_cmd in six.iteritems(cmd.commands):
-            dump_command(out, child_cmd, path + [child_name])
-            data['subcommands'].append(child_name)
+            try:
+                dump_command(out, child_cmd, path + [child_name])
+            except NoHelp:
+                pass
+            else:
+                data['subcommands'].append(child_name)
 
     write_page(out, data)