[Bug 1167533] Re: Completions for some long options are missing. (doesn't parse --help output perfectly)
Peter Cordes
peter at cordes.ca
Sun Nov 30 08:37:24 UTC 2014
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
Foundations Bugs, which is subscribed to bash-completion in Ubuntu.
https://bugs.launchpad.net/bugs/1167533
Title:
Completions for some long options are missing. (doesn't parse --help
output perfectly)
Status in bash-completion package in Ubuntu:
New
Bug description:
I noticed today that "--recursive" is missing from the completions for
grep. A quick glance grep's man page reveals that other long options
such as "--text" are also missing. I'm not sure what the pattern is.
Steps to reproduce:
1) Type "grep --".
2) Press <Tab> twice.
3) Observe that "--recursive" is missing.
ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: bash-completion 1:2.0-1ubuntu3
ProcVersionSignature: Ubuntu 3.8.0-17.27-generic 3.8.6
Uname: Linux 3.8.0-17-generic x86_64
NonfreeKernelModules: nvidia zfs zunicode zavl zcommon znvpair
ApportVersion: 2.9.2-0ubuntu5
Architecture: amd64
Date: Wed Apr 10 12:32:24 2013
InstallationDate: Installed on 2013-04-07 (2 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha amd64 (20130402.1)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: bash-completion
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1167533/+subscriptions
More information about the foundations-bugs
mailing list