From 0ab693ca50206e46f23fccba52eeb8516e2e6fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 26 Mar 2012 22:15:49 +0300 Subject: [PATCH] acpi: New completion. --- completions/Makefile.am | 1 + completions/acpi | 23 +++++++++++++++++++++++ test/completion/acpi.exp | 1 + test/lib/completions/acpi.exp | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 completions/acpi create mode 100644 test/completion/acpi.exp create mode 100644 test/lib/completions/acpi.exp diff --git a/completions/Makefile.am b/completions/Makefile.am index 03165cf4..fabe1c24 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -2,6 +2,7 @@ bashcompdir = $(pkgdatadir)/completions bashcomp_DATA = a2x \ abook \ aclocal \ + acpi \ add_members \ alias \ ant \ diff --git a/completions/acpi b/completions/acpi new file mode 100644 index 00000000..ccc5b635 --- /dev/null +++ b/completions/acpi @@ -0,0 +1,23 @@ +# acpi(1) completion -*- shell-script -*- + +_acpi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-v|--version) + return + ;; + -d|--directory) + _filedir -d + return + ;; + esac + + [[ $cur == -* ]] && \ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _acpi acpi + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/acpi.exp b/test/completion/acpi.exp new file mode 100644 index 00000000..934f6d1c --- /dev/null +++ b/test/completion/acpi.exp @@ -0,0 +1 @@ +assert_source_completions acpi diff --git a/test/lib/completions/acpi.exp b/test/lib/completions/acpi.exp new file mode 100644 index 00000000..278cdceb --- /dev/null +++ b/test/lib/completions/acpi.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "acpi -" +sync_after_int + + +teardown