# svgx-wrap completion -*- shell-script -*-

# the completions for all of the svgx wrapper scripts link here, so
# since those just set --type, this is the same as svgx, just without
# the --type; this sets completion for all wrappers

_svgx_wrap()
{
    local cur prev words cword split
    _init_completion -s || return

    case "$prev" in
        --help | -h | --version | -V)
            return
            ;;
        --backtrace-file | --comments-read | --comments-write | --output | -o)
            _filedir
            return
            ;;
        --backtrace-format)
            COMPREPLY=($(compgen -W "json plain xml" -- "$cur"))
            return
            ;;
    esac

    $split && return

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        return
    fi

    _filedir '@(svg)'
} &&
    for suffix in cpt css3 gimp gpt map pg png pov psp qgs sao svg ; do
        complete -F _svgx_wrap "svg${suffix}"
    done
