From 7985f775fb9cf9b77bbbb394a832f0c5f26de47c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 19 May 2014 14:01:33 +0200 Subject: Completion for bash Change-Id: Ie2cfb3de74f7bec15391110e6c213e839108dc84 Reviewed-by: Thiago Macieira Reviewed-by: Frederik Gladhorn --- scripts/qtchooser.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/qtchooser.bash b/scripts/qtchooser.bash index 294e586..e890c99 100644 --- a/scripts/qtchooser.bash +++ b/scripts/qtchooser.bash @@ -56,3 +56,15 @@ function qt_env_removefrom() eval "$1=\"\${contents[*]}\"" } +# completion: +function _qt() +{ + COMPREPLY=() + if [ ${#COMP_WORDS[@]} -eq 2 ] && [ $COMP_CWORD -eq 1 ]; then + local cur opts + cur="${COMP_WORDS[COMP_CWORD]}" + opts=`qtchooser -list-versions` + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + fi +} +complete -F _qt qt -- cgit v1.2.3