Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- bash-completion | 4 +++- zsh-completion | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bash-completion b/bash-completion index 5151972..c0448ad 100644 --- a/bash-completion +++ b/bash-completion @@ -7,8 +7,10 @@ _rc.d () local caction="${COMP_WORDS[1]}" if ((${COMP_CWORD} == 1)); then COMPREPLY=($(compgen -W "${action}" -- "$cur")) - elif [[ "$caction" =~ help|list ]]; then + elif [[ "$caction" == help ]]; then COMPREPLY=() + elif [[ "$caction" == list ]]; then + ((COMP_CWORD == 2)) && COMPREPLY=($(compgen -W "started stopped" -- "$cur")) || COMPREPLY=() elif [[ "$caction" == start ]]; then COMPREPLY=($(comm -23 <(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort) <(cd /run/daemons/ && compgen -f "$cur"|sort))) elif [[ "$caction" =~ stop|restart|reload ]]; then diff --git a/zsh-completion b/zsh-completion index f1b7165..e5c2850 100644 --- a/zsh-completion +++ b/zsh-completion @@ -15,9 +15,12 @@ _rc.d () { curcontext="${curcontext%:*:*}:rc.d-${action}:" case $action in - list|help) + help) _arguments "*: :" ;; + list) + _arguments "2: :(started stopped)" + ;; start) _arguments "*: :($(comm -23 <(echo /etc/rc.d/*(N-*:t)|tr ' ' '\n') <(echo /run/daemons/*(N:t)|tr ' ' '\n')))" ;; -- Sebastien "Seblu" Luttringer