mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-22 20:54:49 +09:00
M #-: Add onetemplate to the bash_completition (#4129)
+ fix whitespace
(cherry picked from commit 0aacdfa667)
This commit is contained in:
1 parent
07aafca7db
commit
081bdbdaed
1 file changed
+31
-5
@@ -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
|
||||
Reference in new issue
Block a user