Debian Codegraph @

bash-completion/rc-status

raw
1 # Copyright (c) 2017 The OpenRC Authors.
2 # See the Authors file at the top-level directory of this distribution and
3 # https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
4 #
5 # This file is part of OpenRC. It is subject to the license terms in
6 # the LICENSE file found in the top-level directory of this
7 # distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
8 # This file may not be copied, modified, propagated, or distributed
9 # except according to the terms contained in the LICENSE file.
10
11 #
12 # rc-status completion command
13 #
14 _rcstatus()
15 {
16 local cur
17 cur="${COMP_WORDS[COMP_CWORD]}"
18 if [[ $COMP_CWORD -eq 1 ]]; then
19 if [[ "${cur}" == --* ]]; then
20 COMPREPLY=($(compgen -W '--all --list --unused' -- ${cur}))
21 elif [[ "${cur}" == -* ]]; then
22 COMPREPLY=($(compgen -W '-a -l -u' -- ${cur}))
23 else
24 COMPREPLY=($(compgen -W "$(rc-status --list)" -- ${cur}))
25 fi
26 else
27 unset COMPREPLY
28 fi
29 return 0
30 } &&
31 complete -F _rcstatus rc-status