shithub: choc

ref: 6283e91fbd797eed1720ed5b23512f4c3783227c
dir: /man/bash-completion/doom.template.in/

View raw version
# bash completion for @PACKAGE_SHORTNAME@ Doom               -*- shell-script -*-

_@PROGRAM_SPREFIX@_doom()
{
    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
            ;;
        -deh)
            _filedir '@(bex|deh)'
            ;;
    esac

    case $prev in
        -pack)
            COMPREPLY=(doom2 tnt plutonia)
            ;;
        -gameversion)
            COMPREPLY=(1.666 1.7 1.8 1.9 ultimate final final2 hacx chex)
            ;;
        -setmem)
            COMPREPLY=(dos622 dos71 dosbox)
            ;;
    esac

    if [[ $cur == -* ]]; then
        COMPREPLY=( $( compgen -W '@content' -- "$cur" ) )
    fi
} &&

complete -F _@PROGRAM_SPREFIX@_doom @PROGRAM_PREFIX@doom

# ex: ts=4 sw=4 et filetype=sh