Introduce a new PROGRAM_SPREFIX variable in configure.ac, which is basically identical to PROGRAM_PREFIX but without the trailing hyphen. PROGRAM_PREFIX was also redefined so that it bases its name from PACKAGE_SHORTNAME, reducing the number of hardcoded chocolates in the source.
42 lines
1 KiB
Bash
42 lines
1 KiB
Bash
# bash completion for @PACKAGE_SHORTNAME@ Hexen -*- shell-script -*-
|
|
|
|
_@PROGRAM_SPREFIX@_hexen()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
|
|
# 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
|
|
;;
|
|
-file|-iwad|-aa|-af|-as|-merge|-nwtmerge)
|
|
_filedir wad
|
|
;;
|
|
-playdemo|-timedemo)
|
|
_filedir lmp
|
|
;;
|
|
esac
|
|
|
|
case $prev in
|
|
-setmem)
|
|
COMPREPLY=(dos622 dos71 dosbox)
|
|
;;
|
|
esac
|
|
|
|
if [[ $cur == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '@content' -- "$cur" ) )
|
|
fi
|
|
} &&
|
|
|
|
complete -F _@PROGRAM_SPREFIX@_hexen @PROGRAM_PREFIX@hexen
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|