Module: check_mk
Branch: master
Commit: 223105cf10e09777d0deb3367fc473a9fdd67cb8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=223105cf10e097…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Jul 1 17:36:33 2013 +0200
new cmk option --list-man: returns check catalogue as python dict
---
modules/check_mk.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
old mode 100644
new mode 100755
index 3232fc4..fafb013
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3063,7 +3063,7 @@ no_inventory_possible = None
# | |
# +----------------------------------------------------------------------+
-opt_nowiki = False
+opt_nowiki = False
def get_tty_size():
import termios,struct,fcntl
@@ -3105,6 +3105,10 @@ def read_manpage_catalog():
global g_manpage_catalog
g_manpage_catalog = {}
for checkname, path in all_manuals().items():
+ # Skip .* file (.f12)
+ a, filename = os.path.split(path)
+ if filename.startswith("."):
+ continue
parsed = parse_man_header(checkname, path)
cat = parsed["catalog"]
if not cat:
@@ -5154,10 +5158,10 @@ if __name__ == "__main__":
"no-cache", "update", "restart",
"reload", "dump", "fake-dns=",
"man", "nowiki", "config-check",
"backup=", "restore=",
"check-inventory=", "paths",
"cleanup-autochecks", "checks=",
- "cmc-file=", "browse-man" ]
+ "cmc-file=", "browse-man", "list-man"
]
non_config_options = ['-L', '--list-checks', '-P',
'--package', '-M', '--notify',
- '--man', '-V', '--version'
,'-h', '--help', '--automation', ]
+ '--man', '-V', '--version'
,'-h', '--help', '--automation']
try:
opts, args = getopt.getopt(sys.argv[1:], short_options, long_options)
@@ -5289,6 +5293,10 @@ if __name__ == "__main__":
else:
list_all_manuals()
done = True
+ elif o in [ '--list-man' ]:
+ read_manpage_catalog()
+ print pprint.pformat(g_manpage_catalog)
+ done = True
elif o in [ '-m', '--browse-man' ]:
manpage_browser()
done = True