create_manpage_completions.py: refactor: clean up parse_manpage_at_path

This commit is contained in:
MaxVerevkin 2020-07-08 23:43:38 +03:00 committed by Johannes Altmanninger
parent 75f93a590e
commit d1ad143cf1

View File

@ -748,7 +748,21 @@ def cleanup_autogenerated_file(path):
def parse_manpage_at_path(manpage_path, output_directory):
filename = os.path.basename(manpage_path)
# Return if CMDNAME is in 'ignoredcommands'
ignoredcommands = [
"cc",
"g++",
"gcc",
"c++",
"cpp",
"emacs",
"gprof",
"wget",
"ld",
"awk",
]
if CMDNAME in ignoredcommands:
return
# Clear diagnostics
global diagnostic_indent
@ -788,27 +802,10 @@ def parse_manpage_at_path(manpage_path, output_directory):
manpage = str(manpage)
# Get the "base" command, e.g. gcc.1.gz -> gcc
cmd_base = CMDNAME.split(".", 1)[0]
ignoredcommands = [
"cc",
"g++",
"gcc",
"c++",
"cpp",
"emacs",
"gprof",
"wget",
"ld",
"awk",
]
if cmd_base in ignoredcommands:
return
# Ignore perl's gazillion man pages
ignored_prefixes = ["perl", "zsh"]
for prefix in ignored_prefixes:
if cmd_base.startswith(prefix):
if CMDNAME.startswith(prefix):
return
# Ignore the millions of links to BUILTIN(1)