summaryrefslogtreecommitdiff
path: root/completions/sysctl
diff options
context:
space:
mode:
Diffstat (limited to 'completions/sysctl')
-rw-r--r--completions/sysctl31
1 files changed, 18 insertions, 13 deletions
diff --git a/completions/sysctl b/completions/sysctl
index ac25f4ef..0ab37129 100644
--- a/completions/sysctl
+++ b/completions/sysctl
@@ -1,24 +1,29 @@
-# bash completion for sysctl
+# bash completion for sysctl -*- shell-script -*-
-have sysctl &&
_sysctl()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ case $prev in
+ -p)
+ _filedir conf
+ return
+ ;;
+ esac
- COMPREPLY=( $( compgen -W \
- "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
+ 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
} &&
complete -F _sysctl sysctl
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
# ex: ts=4 sw=4 et filetype=sh