sysctl: Add option and option argument completions.

This commit is contained in:
Ville Skyttä 2011-07-19 23:55:24 +03:00
parent d689342a75
commit f896a7e7b2

View File

@ -7,8 +7,22 @@ _sysctl()
local cur prev words cword
_init_completion || return
COMPREPLY=( $( compgen -W \
"$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
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" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
fi
return 0
} &&