[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4ab475b64caca38f90d6675c0e0cf2fdac1de0f2

Ville Skyttä ville.skytta at iki.fi
Sun Apr 19 14:35:13 UTC 2009


The following commit has been merged in the master branch:
commit 6edad88daa42d779e212f0318861d3b45d07b973
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 19 17:33:55 2009 +0300

    Split valid shell completion to _shells().

diff --git a/bash_completion b/bash_completion
index 0f8de5b..428bc8a 100644
--- a/bash_completion
+++ b/bash_completion
@@ -567,6 +567,13 @@ _usergroup()
 	fi
 }
 
+# This function completes on valid shells
+#
+_shells()
+{
+	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( grep "^[[:space:]]*/" \
+			/etc/shells 2>/dev/null )' -- $cur ) )
+}
 
 # Get real command.
 # - arg: $1  Command
@@ -2621,8 +2628,7 @@ _chsh()
 	prev=${COMP_WORDS[COMP_CWORD-1]}
 
 	if [ "$prev" = "-s" ]; then
-		COMPREPLY=( $( compgen -W '$( grep "^[[:space:]]*/" \
-				/etc/shells 2>/dev/null )' -- $cur ) )
+		_shells
 	else
 		COMPREPLY=( $( compgen -u -- $cur ) )
 	fi

-- 
bash-completion



More information about the Bash-completion-commits mailing list