summaryrefslogtreecommitdiffstats
path: root/test/list-undocumented-commands.py
blob: 4729b48acdbaca967cf00c3ef970de2ae100632c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python3
#
# Script to discover and report undocumented commands.

from crmsh.ui_root import Root
from crmsh import help

help.HELP_FILE = "doc/crm.8.adoc"
help._load_help()

_IGNORED_COMMANDS = ('help', 'quit', 'cd', 'up', 'ls')


def check_help(ui):
    for name, child in ui.children().items():
        if child.type == 'command':
            try:
                h = help.help_command(ui.name, name)
                if h.generated and name not in _IGNORED_COMMANDS:
                    print("Undocumented: %s %s" % (ui.name, name))
            except:
                print("Undocumented: %s %s" % (ui.name, name))
        elif child.type == 'level':
            h = help.help_level(name)
            if h.generated:
                print("Undocumented: %s %s" % (ui.name, name))
            check_help(child.level)

check_help(Root())