diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-10-30 01:40:41 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-10-30 01:40:41 -0300 |
commit | c3d6cdb72f7130d3361bc1b8c99e862fe15a75fa (patch) | |
tree | b664bed188c0de713be8a4649fdd86664d1c2867 /bash-completion | |
parent | ede246d73091a7b733ae56819fc7296e18aa4c31 (diff) | |
parent | 00070eca730dec9c6d587cc1639f6abaca83fa34 (diff) |
Merge branch 'master' of git://projects.archlinux.org/initscripts2011.10.3
Conflicts:
PKGBUILD
Diffstat (limited to 'bash-completion')
-rw-r--r-- | bash-completion | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bash-completion b/bash-completion index d78484e..4b4593b 100644 --- a/bash-completion +++ b/bash-completion @@ -3,20 +3,20 @@ _rc_d() { local action cur prev - action="help list start stop reload restart" + actions='help list start stop reload restart' + options='-s --started -S --stopped -a --auto -A --noauto' _get_comp_words_by_ref cur prev - if ((COMP_CWORD == 1)); then - COMPREPLY=($(compgen -W "${action}" -- "$cur")) - elif [[ "$prev" == help ]]; then + _get_first_arg + if [[ -z "$arg" ]]; then + COMPREPLY=($(compgen -W "${actions} ${options}" -- "$cur")) + elif [[ "$arg" == help ]]; then COMPREPLY=() - elif [[ "$prev" == list ]]; then - ((COMP_CWORD == 2)) && COMPREPLY=($(compgen -W "started stopped" -- "$cur")) || COMPREPLY=() - elif [[ "$prev" == start ]]; then + elif [[ "$arg" == start ]]; then COMPREPLY=($(comm -23 <(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort) <(cd /run/daemons/ && compgen -f "$cur"|sort))) - elif [[ "$prev" =~ stop|restart|reload ]]; then + elif [[ "$arg" =~ stop|restart|reload ]]; then COMPREPLY=($(cd /run/daemons/ && compgen -f "$cur"|sort)) - elif ((COMP_CWORD > 1)); then - COMPREPLY=($(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort)) + else + COMPREPLY=($(compgen -W "${options} $(cd /etc/rc.d && compgen -f -X 'functions*')" -- "$cur")) fi } complete -F _rc_d rc.d |