From 29f5a4a5f4403f246e22fb8c2133e8696d2f0e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 16 Mar 2013 20:49:41 +0200 Subject: luac: New completion. --- completions/Makefile.am | 1 + completions/luac | 27 +++++++++++++++++++++++++++ test/completion/luac.exp | 1 + test/lib/completions/luac.exp | 18 ++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 completions/luac create mode 100644 test/completion/luac.exp create mode 100644 test/lib/completions/luac.exp diff --git a/completions/Makefile.am b/completions/Makefile.am index 7f628b58..c195fb5f 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -183,6 +183,7 @@ bashcomp_DATA = a2x \ lrzip \ lsof \ lua \ + luac \ luseradd \ luserdel \ lvm \ diff --git a/completions/luac b/completions/luac new file mode 100644 index 00000000..a0330735 --- /dev/null +++ b/completions/luac @@ -0,0 +1,27 @@ +# luac(1) completion -*- shell-script -*- + +_luac() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -v|-) + return + ;; + -o) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + return + fi + + _filedir lua +} && +complete -F _luac luac + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/luac.exp b/test/completion/luac.exp new file mode 100644 index 00000000..63f49ee7 --- /dev/null +++ b/test/completion/luac.exp @@ -0,0 +1 @@ +assert_source_completions luac diff --git a/test/lib/completions/luac.exp b/test/lib/completions/luac.exp new file mode 100644 index 00000000..d7cfb23b --- /dev/null +++ b/test/lib/completions/luac.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "luac " +sync_after_int + + +teardown -- cgit v1.2.1