aboutsummaryrefslogtreecommitdiff
path: root/app_completion
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-14 11:14:59 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-14 11:14:59 +0200
commitcd470d4d622640a6b1a4d84082e3107ca44a16a4 (patch)
treeaceb55b3c7e8e9ba987fce2ad67f2f9900b0b0ed /app_completion
parentda3c4a56ba633d65e1a3010a4fe8462e996cd714 (diff)
downloadapp.sh-cd470d4d622640a6b1a4d84082e3107ca44a16a4.tar.gz
app.sh-cd470d4d622640a6b1a4d84082e3107ca44a16a4.tar.bz2
app.sh-cd470d4d622640a6b1a4d84082e3107ca44a16a4.tar.xz
app.sh-cd470d4d622640a6b1a4d84082e3107ca44a16a4.zip
o Improved completion after refactoring, not done yet.
Diffstat (limited to 'app_completion')
-rw-r--r--app_completion34
1 files changed, 17 insertions, 17 deletions
diff --git a/app_completion b/app_completion
index 62050fd..68a3b7b 100644
--- a/app_completion
+++ b/app_completion
@@ -6,13 +6,9 @@ _appsh_contains() {
}
_appsh_methods=(
+ "app"
"conf"
- "install"
- "list"
- "list-versions"
- "set-current"
- "start"
- "stop"
+ "operate"
)
_appsh_parse_opts() {
@@ -32,49 +28,53 @@ _appsh_parse_opts() {
prev="${COMP_WORDS[$i]}"
done
echo "local has_method='$has_method'"
+
+ case "${COMP_WORDS[COMP_CWORD]}" in
+ -*)
+ echo "local in_option=yes"
+ ;;
+ esac
}
_complete_appsh() {
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
- local opts
+ local opts=""
eval `_appsh_parse_opts`
if [ $COMP_CWORD == 1 ]
then
opts="${_appsh_methods[@]}"
+ opts="$opts"
+ if [ "$in_option" = "yes" ]
+ then
opts="-n $opts"
+ fi
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
case $prev in
-n)
- values=$(./app list -P name)
+ values=$(./app app list -P name)
COMPREPLY=($(compgen -W "$values" -- ${cur}))
return 0
;;
-i)
if [ -n "$has_n" ]
then
- values=$(./app list -n $has_n -P instance)
+ values=$(./app app list -n $has_n -P instance)
COMPREPLY=($(compgen -W "$values" -- ${cur}))
return 0
fi
;;
esac
- opts=""
- if [ -z "$has_n" ]
+ if [ -n "$has_n" -a -z "$has_i" ]
then
- opts="$opts -n"
- else
- if [ -z "$has_i" ]
- then
- opts="$opts -i"
- fi
+ opts="$opts -i"
fi
if [ -z "$has_method" ]