aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2014-06-05 13:21:31 +0200
committerUlrich Müller <ulm@gentoo.org>2014-06-05 13:21:31 +0200
commit5df2ce07583dc623dd6b6caec17d9e73bfb47e1d (patch)
tree7ca48342036fdd7aa77e61100505d5fb4e1f5e20
parentAlways parse global options. Respect "--". (diff)
downloadeselect-5df2ce07583dc623dd6b6caec17d9e73bfb47e1d.tar.gz
eselect-5df2ce07583dc623dd6b6caec17d9e73bfb47e1d.tar.bz2
eselect-5df2ce07583dc623dd6b6caec17d9e73bfb47e1d.zip
eselect.bashcomp: Improve handling of options followed by an equals sign.
* misc/eselect.bashcomp (_eselect): Improve handling of options that are followed by an equals sign.
-rw-r--r--ChangeLog3
-rw-r--r--misc/eselect.bashcomp7
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c3f0061..1f01c16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2014-06-05 Ulrich Müller <ulm@gentoo.org>
+ * misc/eselect.bashcomp (_eselect): Improve handling of options
+ that are followed by an equals sign.
+
* bin/eselect.in: Parse global options even if we are invoked
as something-config or similar. Respect "--" to indicate end
of options.
diff --git a/misc/eselect.bashcomp b/misc/eselect.bashcomp
index da3e55b..bd5afe3 100644
--- a/misc/eselect.bashcomp
+++ b/misc/eselect.bashcomp
@@ -8,7 +8,7 @@
_eselect() {
local cur sedcmd2 sedcmd3 possibles
- local options="--brief --color --colour"
+ local options="--brief --color= --colour="
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
sedcmd2='s/^ \([[:alnum:]-][[:alnum:]_-]*\)[[:space:],].*$/\1/p'
@@ -17,6 +17,7 @@ _eselect() {
set -- "${COMP_WORDS[@]:1}"
# skip global options
while [[ $# -gt 1 && $1 == -* ]]; do
+ [[ $2 == "=" ]] && shift 2
shift
done
# skip any subaction options
@@ -38,8 +39,10 @@ _eselect() {
;;
esac
- [[ -n "${possibles}" ]] && \
+ if [[ -n "${possibles}" ]]; then
COMPREPLY=( $(compgen -W "${possibles}" -- ${cur}) )
+ [[ ${COMPREPLY[0]} == *= ]] && compopt -o nospace
+ fi
return 0
}