Strip out brackets from generated-by-manpage completions.

Handles cases like cupsctl --\[no-\]remote-admin and
unxz --powerpc[ better.

Fixes #3272
This commit is contained in:
Aaron Gyes 2016-07-30 21:57:11 -07:00
parent 6c8ecab44b
commit e75fc8452f

View file

@ -129,8 +129,10 @@ def built_command(options, description):
# print "Options are: ", options
man_optionlist = re.split(" |,|\"|=|[|]", options)
fish_options = []
for option in man_optionlist:
option = option.strip()
for optionstr in man_optionlist:
option = re.sub(r"(\[.*\])", "", optionstr)
option = option.strip(" \t\n[]()")
# Skip some problematic cases
if option in ['-', '--']: continue