[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-450-ga6c9c61

Ville Skyttä ville.skytta at iki.fi
Tue Oct 11 18:11:22 UTC 2011


The following commit has been merged in the master branch:
commit a6c9c614d4f55b5cfa0387b68e98d4e609b1f2af
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Oct 11 21:10:45 2011 +0300

    dmesg: New completion.

diff --git a/completions/util-linux b/completions/util-linux
index 6243a4d..6246b11 100644
--- a/completions/util-linux
+++ b/completions/util-linux
@@ -116,6 +116,31 @@ _ionice()
 } &&
 complete -F _ionice ionice
 
+have dmesg &&
+_dmesg()
+{
+    [[ $OSTYPE == *solaris* ]] && return # no args there
+
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -s|-M|-N)
+            return
+            ;;
+        -n)
+            COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) )
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+        return
+    fi
+} &&
+complete -F _dmesg dmesg
+
 # Local variables:
 # mode: shell-script
 # sh-basic-offset: 4
diff --git a/test/completion/dmesg.exp b/test/completion/dmesg.exp
new file mode 100644
index 0000000..1eca1e5
--- /dev/null
+++ b/test/completion/dmesg.exp
@@ -0,0 +1 @@
+assert_source_completions dmesg
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/dmesg.exp
similarity index 79%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/dmesg.exp
index 77cd07f..79f2e04 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/dmesg.exp
@@ -11,9 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
-
-
+assert_complete_any "dmesg -"
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list