[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-406-gf896a7e

Ville Skyttä ville.skytta at iki.fi
Tue Jul 19 20:56:17 UTC 2011


The following commit has been merged in the master branch:
commit f896a7e7b257e7e3b389cda647e856577e22fe97
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jul 19 23:55:24 2011 +0300

    sysctl: Add option and option argument completions.

diff --git a/completions/sysctl b/completions/sysctl
index 880ad9d..8c7d68a 100644
--- a/completions/sysctl
+++ b/completions/sysctl
@@ -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
 } &&

-- 
bash-completion



More information about the Bash-completion-commits mailing list