[Bash-completion-commits] [SCM] bash-completion branch, master, updated. b556b22d8717e8c9d547f07aebc8c902ea22af3f
Ville Skyttä
ville.skytta at iki.fi
Tue Apr 14 21:09:52 UTC 2009
The following commit has been merged in the master branch:
commit bce0b30bbe62dea25f1690f4f1d54e975b684c45
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue Apr 14 23:55:50 2009 +0300
Use _split_longopt in _longopt.
diff --git a/CHANGES b/CHANGES
index ed2f1ef..e7fd563 100644
--- a/CHANGES
+++ b/CHANGES
@@ -34,7 +34,8 @@ bash-completion (1.x)
input in external command arguments.
* Add _split_longopt() helper for improved handling of long options that
take arguments in both "--foo bar" and "--foo=bar" formats.
- * Use _split_longopt to improve and clean up aspell, chgrp, chown completion.
+ * Use _split_longopt to improve and clean up aspell, chgrp, chown, and
+ generic long option completion.
* Add chown --from and --reference value completions.
* Add chgrp --reference value completion.
diff --git a/bash_completion b/bash_completion
index 0cd8b4c..d331868 100644
--- a/bash_completion
+++ b/bash_completion
@@ -4294,25 +4294,19 @@ complete -F _psql $default psql
_longopt()
{
- local cur opt
+ local cur prev
cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- if [[ "$cur" == --*=* ]]; then
- opt=${cur%%=*}
- # cut backslash that gets inserted before '=' sign
- opt=${opt%\\*}
- cur=${cur#*=}
+ if _split_longopt; then
_filedir
- # FIXME: see #297065... adding "-o nospace" (or $nospace),
- # should do the trick, but seems not working... ideas?
- COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
return 0
fi
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
- -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
+ -e 's/.*\(--[-A-Za-z0-9]\+\).*/\1/' | \
command grep "^$cur" | sort -u ) )
elif [[ "$1" == rmdir ]]; then
_filedir -d
--
bash-completion
More information about the Bash-completion-commits
mailing list