1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

M #-: Add onetemplate to the bash_completition (#4129)

+ fix whitespace

(cherry picked from commit 0aacdfa667a8b4931a9d730e2ecab38713135788)
This commit is contained in:
Jan Orel 2020-01-29 10:41:41 +01:00 committed by Ruben S. Montero
parent 07aafca7db
commit 081bdbdaed
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -4,7 +4,7 @@ _one_list() {
if [ -n "$2" ]; then
filter="-f $2"
fi
echo $($one_cmd $filter list|sed 1d|awk '{print $1}')
echo $($one_cmd $filter list|sed 1d|awk '{print $1}')
return 0
}
@ -22,7 +22,7 @@ _onevm() {
then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
elif [ $COMP_CWORD == 2 ]
elif [ $COMP_CWORD == 2 ]
then
case "$prev" in
show|delete)
@ -45,7 +45,7 @@ _onevm() {
return 0
;;
esac
elif [ $COMP_CWORD == 3 ]
elif [ $COMP_CWORD == 3 ]
then
case "$pprev" in
migrate)
@ -70,7 +70,7 @@ _onevnet() {
then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
elif [ $COMP_CWORD == 2 ]
elif [ $COMP_CWORD == 2 ]
then
case "$prev" in
create|submit)
@ -100,7 +100,7 @@ _onehost() {
then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
elif [ $COMP_CWORD == 2 ]
elif [ $COMP_CWORD == 2 ]
then
case "$prev" in
create|submit)
@ -128,3 +128,29 @@ _onehost() {
}
complete -F _onehost onehost
_onetemplate() {
local cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="create clone delete instantiate chgrp chown chmod "
opts+="update rename list show top lock unlock"
cmd=onetemplate
if [ $COMP_CWORD == 1 ]
then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
elif [ $COMP_CWORD == 2 ]
then
case "$prev" in
create)
COMPREPLY=( $(compgen -A file -- ${cur}) )
return 0
;;
esac
fi
}
complete -F _onetemplate onetemplate