ref: cb4848b8daf84077e6b770900353389838a5a9a3
parent: 278cd34b3e2e80816e2ecde3cc8ae82c50f63f49
author: Fabian Greffrath <[email protected]>
date: Fri Oct 30 04:53:37 EDT 2015
bash-completion: allow multiple files with the same extensions passed to the same switch, e.g. -file a.wad b.wad. Also, fix the -setmen typo.
--- a/man/bash-completion/doom.template
+++ b/man/bash-completion/doom.template
@@ -5,7 +5,16 @@
local cur prev words cword
_init_completion || return
- case $prev in
+ # Save the previous switch on the command line in the prevsw variable
+ local i prevsw=""
+ for (( i=1; $cword > 1 && i <= $cword; i++ )); do
+ if [[ ${words[i]} == -* ]]; then
+ prevsw=${words[i]}
+ fi
+ done
+
+ # Allow adding more than one file with the same extension to the same switch
+ case $prevsw in
-config|-extraconfig)
_filedir cfg
;;
@@ -12,6 +21,15 @@
-file|-iwad|-aa|-af|-as|-merge|-nwtmerge)
_filedir wad
;;
+ -playdemo|-timedemo)
+ _filedir lmp
+ ;;
+ -deh)
+ _filedir '@(bex|deh)'
+ ;;
+ esac
+
+ case $prev in
-pack)
COMPREPLY=(doom2 tnt plutonia)
;;
@@ -18,14 +36,8 @@
-gameversion)
COMPREPLY=(1.9 ultimate final final2 hacx chex)
;;
- -setmen)
+ -setmem)
COMPREPLY=(dos622 dos71 dosbox)
- ;;
- -playdemo|-timedemo)
- _filedir lmp
- ;;
- -deh)
- _filedir '@(bex|deh)'
;;
esac
--- a/man/bash-completion/heretic.template
+++ b/man/bash-completion/heretic.template
@@ -5,7 +5,16 @@
local cur prev words cword
_init_completion || return
- case $prev in
+ # Save the previous switch on the command line in the prevsw variable
+ local i prevsw=""
+ for (( i=1; $cword > 1 && i <= $cword; i++ )); do
+ if [[ ${words[i]} == -* ]]; then
+ prevsw=${words[i]}
+ fi
+ done
+
+ # Allow adding more than one file with the same extension to the same switch
+ case $prevsw in
-config|-extraconfig)
_filedir cfg
;;
@@ -12,17 +21,20 @@
-file|-iwad|-aa|-af|-as|-merge|-nwtmerge)
_filedir wad
;;
- -hhever)
- COMPREPLY=(1.0 1.2 1.3)
- ;;
- -setmen)
- COMPREPLY=(dos622 dos71 dosbox)
- ;;
-playdemo|-timedemo)
_filedir lmp
;;
-deh)
_filedir hhe
+ ;;
+ esac
+
+ case $prev in
+ -hhever)
+ COMPREPLY=(1.0 1.2 1.3)
+ ;;
+ -setmem)
+ COMPREPLY=(dos622 dos71 dosbox)
;;
esac
--- a/man/bash-completion/hexen.template
+++ b/man/bash-completion/hexen.template
@@ -5,7 +5,16 @@
local cur prev words cword
_init_completion || return
- case $prev in
+ # Save the previous switch on the command line in the prevsw variable
+ local i prevsw=""
+ for (( i=1; $cword > 1 && i <= $cword; i++ )); do
+ if [[ ${words[i]} == -* ]]; then
+ prevsw=${words[i]}
+ fi
+ done
+
+ # Allow adding more than one file with the same extension to the same switch
+ case $prevsw in
-config|-extraconfig)
_filedir cfg
;;
@@ -12,11 +21,14 @@
-file|-iwad|-aa|-af|-as|-merge|-nwtmerge)
_filedir wad
;;
- -setmen)
- COMPREPLY=(dos622 dos71 dosbox)
- ;;
-playdemo|-timedemo)
_filedir lmp
+ ;;
+ esac
+
+ case $prev in
+ -setmem)
+ COMPREPLY=(dos622 dos71 dosbox)
;;
esac
--- a/man/bash-completion/strife.template
+++ b/man/bash-completion/strife.template
@@ -5,7 +5,16 @@
local cur prev words cword
_init_completion || return
- case $prev in
+ # Save the previous switch on the command line in the prevsw variable
+ local i prevsw=""
+ for (( i=1; $cword > 1 && i <= $cword; i++ )); do
+ if [[ ${words[i]} == -* ]]; then
+ prevsw=${words[i]}
+ fi
+ done
+
+ # Allow adding more than one file with the same extension to the same switch
+ case $prevsw in
-config|-extraconfig)
_filedir cfg
;;
@@ -12,17 +21,20 @@
-file|-iwad|-aa|-af|-as|-merge|-nwtmerge)
_filedir wad
;;
- -gameversion)
- COMPREPLY=(1.2 1.31)
- ;;
- -setmen)
- COMPREPLY=(dos622 dos71 dosbox)
- ;;
-playdemo|-timedemo)
_filedir lmp
;;
-deh)
_filedir seh
+ ;;
+ esac
+
+ case $prev in
+ -gameversion)
+ COMPREPLY=(1.2 1.31)
+ ;;
+ -setmem)
+ COMPREPLY=(dos622 dos71 dosbox)
;;
esac