[Bash-completion-devel] longopt & sed

gibboris at gmail.com gibboris at gmail.com
Sun Jan 3 23:18:05 UTC 2010


Hi,
_longopt is no used a lot.
I don't know why as it's very useful.
[insert the rationale about long options,
build time features, less typing, more extensible, ...]
To match the --help where several option are documented
on one line only I wrote a small sed script to be used
in _longopt which addresses the problem [attached].
eg: the --silent option of chown --help|sed -n -f longopt.sed

wish it may help

Raph
-------------- next part --------------
: begin
h
: printlong
g
s/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p
# if no more match ("T") restart with
# next line
T nextline
g
#keep everything except the pattern
#from the last long option to EOL
s/^\(.*\)--[-A-Za-z0-9].*$/\1/
h
t printlong
: nextline
n
b begin


More information about the Bash-completion-devel mailing list