#compdef tar2arx

autoload -U is-at-least

_tar2arx() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-o+[Archive name to create]:OUTFILE:_files' \
'--outfile=[Archive name to create]:OUTFILE:_files' \
'-c+[Set compression algorithm to use]:COMPRESSION:_default' \
'--compression=[Set compression algorithm to use]:COMPRESSION:_default' \
'--generate-complete=[]:GENERATE_COMPLETE:(bash elvish fish powershell zsh)' \
'-1[Create only one file (default)]' \
'--one-file[Create only one file (default)]' \
'-2[Create two files (a content pack and other)]' \
'--two-files[Create two files (a content pack and other)]' \
'-N[Create mulitples files (one per pack)]' \
'--multiple-files[Create mulitples files (one per pack)]' \
'--list-compressions[List available compression algorithms]' \
'--generate-man-page[]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::tar_file -- Tar file to convert:_files' \
&& ret=0
}

(( $+functions[_tar2arx_commands] )) ||
_tar2arx_commands() {
    local commands; commands=()
    _describe -t commands 'tar2arx commands' commands "$@"
}

if [ "$funcstack[1]" = "_tar2arx" ]; then
    _tar2arx "$@"
else
    compdef _tar2arx tar2arx
fi
