| 3 |
- |
1 |
# bash completion for tuned and tuned-adm
|
|
|
2 |
|
|
|
3 |
_tuned()
|
|
|
4 |
{
|
|
|
5 |
local options="-d --daemon -c --config -D --debug"
|
|
|
6 |
local current="${COMP_WORDS[$COMP_CWORD]}"
|
|
|
7 |
local previous="${COMP_WORDS[$COMP_CWORD-1]}"
|
|
|
8 |
|
|
|
9 |
if [[ "$previous" == "-c" || "$previous" == "--config" ]]; then
|
|
|
10 |
COMPREPLY=( $(compgen -f -- "$current") )
|
|
|
11 |
else
|
|
|
12 |
COMPREPLY=( $(compgen -W "$options" -- "$current") )
|
|
|
13 |
fi
|
|
|
14 |
|
|
|
15 |
return 0
|
|
|
16 |
} &&
|
|
|
17 |
complete -F _tuned -o filenames tuned
|
|
|
18 |
|
|
|
19 |
_tuned_adm()
|
|
|
20 |
{
|
|
|
21 |
local commands="help list active off profile"
|
|
|
22 |
local current="${COMP_WORDS[$COMP_CWORD]}"
|
|
|
23 |
local previous="${COMP_WORDS[$COMP_CWORD-1]}"
|
|
|
24 |
|
|
|
25 |
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
|
26 |
COMPREPLY=( $(compgen -W "$commands" -- "$current" ) )
|
|
|
27 |
elif [[ $COMP_CWORD -eq 2 && "$previous" == "profile" ]]; then
|
|
|
28 |
COMPREPLY=( $(compgen -W "$(command ls -F /etc/tune-profiles | \
|
|
|
29 |
sed '/\/$/!d;s/.$//')" -- "$current" ) )
|
|
|
30 |
else
|
|
|
31 |
COMPREPLY=()
|
|
|
32 |
fi
|
|
|
33 |
|
|
|
34 |
return 0
|
|
|
35 |
} &&
|
|
|
36 |
complete -F _tuned_adm tuned-adm
|
|
|
37 |
|
|
|
38 |
# Local variables:
|
|
|
39 |
# mode: shell-script
|
|
|
40 |
# sh-basic-offset: 4
|
|
|
41 |
# sh-indent-comment: t
|
|
|
42 |
# indent-tabs-mode: nil
|
|
|
43 |
# End:
|
|
|
44 |
# ex: ts=4 sw=4 et filetype=sh
|