summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-10-11 21:10:45 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-10-11 21:10:45 +0300
commita6c9c614d4f55b5cfa0387b68e98d4e609b1f2af (patch)
treeb3958d30abcd012c57195f2c7f04e226075bb26a
parent049b60ec61bebfd82e88eba3bc1df6fc138c38e5 (diff)
downloadbash-completion-a6c9c614d4f55b5cfa0387b68e98d4e609b1f2af.tar.gz
dmesg: New completion.
-rw-r--r--completions/util-linux25
-rw-r--r--test/completion/dmesg.exp1
-rw-r--r--test/lib/completions/dmesg.exp18
3 files changed, 44 insertions, 0 deletions
diff --git a/completions/util-linux b/completions/util-linux
index 6243a4d9..6246b118 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 00000000..1eca1e5b
--- /dev/null
+++ b/test/completion/dmesg.exp
@@ -0,0 +1 @@
+assert_source_completions dmesg
diff --git a/test/lib/completions/dmesg.exp b/test/lib/completions/dmesg.exp
new file mode 100644
index 00000000..79f2e04a
--- /dev/null
+++ b/test/lib/completions/dmesg.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dmesg -"
+sync_after_int
+
+
+teardown