[Bash-completion-commits] [SCM] bash-completion branch, master, updated. c6e9334cfa9af956c2711f5b8930802d52efacc4
Ville Skyttä
ville.skytta at iki.fi
Sat Dec 26 10:32:53 UTC 2009
The following commit has been merged in the master branch:
commit c6e9334cfa9af956c2711f5b8930802d52efacc4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sat Dec 26 12:31:26 2009 +0200
Add GNU chsh option completions.
diff --git a/CHANGES b/CHANGES
index 75b8ca8..fe0c24b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -24,7 +24,7 @@ bash-completion (2.x)
* Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist.
- * Improve configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer,
+ * Improve chsh, configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer,
mysqladmin, rsync, screen, service, scp, ssh, update-alternatives,
vncviewer, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
diff --git a/contrib/chsh b/contrib/chsh
index 46ee029..23e1500 100644
--- a/contrib/chsh
+++ b/contrib/chsh
@@ -8,8 +8,19 @@ _chsh()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
- if [ "$prev" = "-s" ]; then
- _shells
+ case "$prev" in
+ --list-shells|--help|-v|--version)
+ return 0
+ ;;
+ -s|--shell)
+ _shells
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then
+ COMPREPLY=( $( compgen -W '--shell --list-shells --help --version' \
+ -- "$cur" ) )
else
COMPREPLY=( $( compgen -u -- "$cur" ) )
fi
--
bash-completion
More information about the Bash-completion-commits
mailing list