From e75fc8452f553560dbd61d3e1283284473c07475 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 30 Jul 2016 21:57:11 -0700 Subject: [PATCH] Strip out brackets from generated-by-manpage completions. Handles cases like cupsctl --\[no-\]remote-admin and unxz --powerpc[ better. Fixes #3272 --- share/tools/create_manpage_completions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index c58adae2d..87c9b93b8 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -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