roxide 0.2.20

A better rm command for your terminal
#compdef roxide

autoload -U is-at-least

_roxide() {
    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[@]}" : \
'-i+[whether to prompt before removals]:INTERACTIVE:((never\:"Never prompt"
once\:"Prompt once before removing more than three files or when removing recursivly"
always\:"Prompt before every removal"))' \
'--interactive=[whether to prompt before removals]:INTERACTIVE:((never\:"Never prompt"
once\:"Prompt once before removing more than three files or when removing recursivly"
always\:"Prompt before every removal"))' \
'-p+[remove files matching the pattern. revert will not work on patterns, provide -rp for recursive remove]:PATTERN:_default' \
'--pattern=[remove files matching the pattern. revert will not work on patterns, provide -rp for recursive remove]:PATTERN:_default' \
'*-f+[Forces deletion without moving files to the trash directory]:FILE:_files' \
'*--force=[Forces deletion without moving files to the trash directory]:FILE:_files' \
'-r[Remove directories and their contents recursively]' \
'--recursive[Remove directories and their contents recursively]' \
'-l[list items which will be affected, (dry run)]' \
'--list[list items which will be affected, (dry run)]' \
'-v[Enable verbose output]' \
'--verbose[Enable verbose output]' \
'-d[remove empty directories]' \
'--dir[remove empty directories]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::file -- Remove files:_files' \
":: :_roxide_commands" \
"*::: :->roxide" \
&& ret=0
    case $state in
    (roxide)
        words=($line[2] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:roxide-command-$line[2]:"
        case $line[2] in
            (revert)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_roxide__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:roxide-help-command-$line[1]:"
        case $line[1] in
            (revert)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_roxide_commands] )) ||
_roxide_commands() {
    local commands; commands=(
'revert:revert the previous remove' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'roxide commands' commands "$@"
}
(( $+functions[_roxide__help_commands] )) ||
_roxide__help_commands() {
    local commands; commands=(
'revert:revert the previous remove' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'roxide help commands' commands "$@"
}
(( $+functions[_roxide__help__help_commands] )) ||
_roxide__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'roxide help help commands' commands "$@"
}
(( $+functions[_roxide__help__revert_commands] )) ||
_roxide__help__revert_commands() {
    local commands; commands=()
    _describe -t commands 'roxide help revert commands' commands "$@"
}
(( $+functions[_roxide__revert_commands] )) ||
_roxide__revert_commands() {
    local commands; commands=()
    _describe -t commands 'roxide revert commands' commands "$@"
}

if [ "$funcstack[1]" = "_roxide" ]; then
    _roxide "$@"
else
    compdef _roxide roxide
fi