sysctl: Add option and option argument completions.
This commit is contained in:
parent
d689342a75
commit
f896a7e7b2
@ -7,8 +7,22 @@ _sysctl()
|
|||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
_init_completion || return
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W \
|
case $prev in
|
||||||
|
-p)
|
||||||
|
_filedir conf
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||||
|
else
|
||||||
|
local suffix=
|
||||||
|
[[ $prev == -w ]] && suffix==
|
||||||
|
COMPREPLY=( $( compgen -S "$suffix" -W \
|
||||||
"$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
|
"$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
|
||||||
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} &&
|
} &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user