fixed it: echo ' -r, --recursive like --directories=recurse' | sed -ne 's/\([^-]\|-[^-]\)*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\2/p' --recursive
using \([^-]\|-[^-]\)* instead of .* at the front of the pattern makes the greedy match at the front stop at the first --. If there are commands that use -- as formatting in their --help output, then this won't work, e.g. -r -- equivalent to --recursive but otherwise this should be good. It's pretty much standard to list the actual options early in a line, rather than like --directories=recurse -r, --recursive This goes in _longopt(), line 1801 of bash_completion. I'll submit this upstream, too -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1167533 Title: Completions for some long options are missing. (doesn't parse --help output perfectly) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1167533/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs