summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2011-11-17 18:35:49 +0300
committerIgor Murzov <e-mail@date.by>2011-11-17 18:35:49 +0300
commit43e8e2b5045cd5ee702e867a7cf9757287bdf755 (patch)
tree750c55d44dae05b75e6ddac4b22864db10a4cac2
parent82784121d863bede6b40433a52cceaabb79d7df6 (diff)
downloadbash-completion-43e8e2b5045cd5ee702e867a7cf9757287bdf755.tar.gz
wine: Complete all files after an .exe (Alioth #313131)
-rw-r--r--bash_completion1
-rw-r--r--completions/Makefile.am1
-rw-r--r--completions/wine20
-rw-r--r--test/completion/wine.exp1
-rw-r--r--test/lib/completions/wine.exp31
5 files changed, 53 insertions, 1 deletions
diff --git a/bash_completion b/bash_completion
index bae27ea6..56226f61 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1847,7 +1847,6 @@ _install_xspec '!*.@(mid?(i)|cmf)' playmidi
_install_xspec '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|okta|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123
_install_xspec '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
-_install_xspec '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
_install_xspec '!*.@(zip|z|gz|tgz)' bzme
# konqueror not here on purpose, it's more than a web/html browser
_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 66f0eeb9..c6ff1ec8 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -305,6 +305,7 @@ bashcomp_DATA = a2x \
vpnc \
watch \
webmitm \
+ wine \
withlist \
wodim \
wol \
diff --git a/completions/wine b/completions/wine
new file mode 100644
index 00000000..58e4cf46
--- /dev/null
+++ b/completions/wine
@@ -0,0 +1,20 @@
+# bash completion for wine(1) -*- shell-script -*-
+
+_wine()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cword" -eq 1 ]]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $(compgen -W '--help --version' -- "$cur") )
+ [[ $COMPREPLY ]] && return
+ fi
+ _filedir '[eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR]'
+ else
+ _filedir
+ fi
+} &&
+complete -F _wine wine
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/wine.exp b/test/completion/wine.exp
new file mode 100644
index 00000000..ddb1e6f1
--- /dev/null
+++ b/test/completion/wine.exp
@@ -0,0 +1 @@
+assert_source_completions wine
diff --git a/test/lib/completions/wine.exp b/test/lib/completions/wine.exp
new file mode 100644
index 00000000..2cc60c48
--- /dev/null
+++ b/test/lib/completions/wine.exp
@@ -0,0 +1,31 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+set test "should complete *.exe, *.com files and dirs"
+set dir $::srcdir/fixtures/shared/default
+assert_complete_dir {"bar bar.d/" foo.d/} "wine " $dir $test
+
+
+sync_after_int
+
+
+set test "should complete any files and dirs after executable"
+set dir $::srcdir/fixtures/shared/default
+set files {bar "bar bar.d/" foo foo.d/}
+assert_complete_dir $files "wine notepad " $dir $test
+
+
+sync_after_int
+
+
+teardown