moulinette/etc/moulinette_cli

34 lines
718 B
Text
Raw Normal View History

2012-10-16 14:56:54 +02:00
# yunohost(1) completion
_yunohost_cli()
{
local argc cur prev opts
COMPREPLY=()
argc=${COMP_CWORD}
cur="${COMP_WORDS[argc]}"
2014-02-05 02:01:03 +01:00
prev="${COMP_WORDS[argc-1]}"
2013-11-26 02:50:53 +01:00
opts=$(yunohost -h | sed -n "/usage/,/}/p" | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
2012-10-16 14:56:54 +02:00
if [[ $argc = 1 ]];
then
COMPREPLY=( $(compgen -W "$opts --help" -- $cur ) )
fi
2014-02-05 02:01:03 +01:00
2012-10-16 14:56:54 +02:00
if [[ "$prev" != "--help" ]];
then
if [[ $argc = 2 ]];
then
2013-11-26 02:50:53 +01:00
opts2=$(yunohost $prev -h | sed -n "/usage/,/}/p" | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
2012-10-16 14:56:54 +02:00
COMPREPLY=( $(compgen -W "$opts2 --help" -- $cur ) )
elif [[ $argc = 3 ]];
then
2014-02-05 02:01:03 +01:00
COMPREPLY=( $(compgen -W "--help" $cur ) )
2012-10-16 14:56:54 +02:00
fi
2014-02-05 02:01:03 +01:00
else
2012-10-16 14:56:54 +02:00
COMPREPLY=()
fi
}
2013-11-26 02:50:53 +01:00
complete -F _yunohost_cli yunohost