mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
add bash completion
This commit is contained in:
parent
254f6421a5
commit
8e105ca54d
1 changed files with 33 additions and 0 deletions
33
appconftest/bash/yunohost
Normal file
33
appconftest/bash/yunohost
Normal file
|
@ -0,0 +1,33 @@
|
|||
# yuno-repo(1) completion
|
||||
|
||||
_yunohost()
|
||||
{
|
||||
local argc cur prev opts
|
||||
COMPREPLY=()
|
||||
|
||||
argc=${COMP_CWORD}
|
||||
cur="${COMP_WORDS[argc]}"
|
||||
prev="${COMP_WORDS[argc-1]}"
|
||||
opts=$(yunohost2 -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
||||
|
||||
if [[ $argc = 1 ]];
|
||||
then
|
||||
COMPREPLY=( $(compgen -W "$opts --help" -- $cur ) )
|
||||
fi
|
||||
|
||||
if [[ "$prev" != "--help" ]];
|
||||
then
|
||||
if [[ $argc = 2 ]];
|
||||
then
|
||||
opts2=$(yunohost2 $prev -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
||||
COMPREPLY=( $(compgen -W "$opts2 --help" -- $cur ) )
|
||||
elif [[ $argc = 3 ]];
|
||||
then
|
||||
COMPREPLY=( $(compgen -W "--help" $cur ) )
|
||||
fi
|
||||
else
|
||||
COMPREPLY=()
|
||||
fi
|
||||
|
||||
}
|
||||
complete -F _yunohost yunohost
|
Loading…
Reference in a new issue