#compdef rtag

autoload -U is-at-least

_rtag() {
    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[@]}" : \
'-n+[]:NAMESPACE:_default' \
'--namespace=[]:NAMESPACE:_default' \
'-F+[]:OUTPUT_FORMAT:(json xml)' \
'--output-format=[]:OUTPUT_FORMAT:(json xml)' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_rtag_commands" \
"*::: :->rtag" \
&& ret=0
    case $state in
    (rtag)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rtag-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
'-0[Null byte separeted values, disables pretty printing]' \
'--print0[Null byte separeted values, disables pretty printing]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to get tags from:_files' \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" : \
'-0[Null byte separeted values, disables pretty printing]' \
'--print0[Null byte separeted values, disables pretty printing]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to get tags from:_files' \
&& ret=0
;;
(get)
_arguments "${_arguments_options[@]}" : \
'-0[Null byte separeted values, disables pretty printing]' \
'--print0[Null byte separeted values, disables pretty printing]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to get tags from:_files' \
&& ret=0
;;
(get-raw)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to get raw tags from:_files' \
&& ret=0
;;
(set)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to set tags to]::FILES:_files' \
'*--files=[Files to set tags to]::FILES:_files' \
'*-t+[Tags to set to files]:TAGS:_default' \
'*--tags=[Tags to set to files]:TAGS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(set-raw)
_arguments "${_arguments_options[@]}" : \
'*-f+[]::FILES:_files' \
'*--files=[]::FILES:_files' \
'-h[Print help]' \
'--help[Print help]' \
':rawtags -- Raw tags to set to files:_default' \
'::file -- File:_files' \
&& ret=0
;;
(add-raw)
_arguments "${_arguments_options[@]}" : \
'*-f+[]::FILES:_files' \
'*--files=[]::FILES:_files' \
'-h[Print help]' \
'--help[Print help]' \
':rawtags -- Raw tags to add to files:_default' \
'::file -- File:_files' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to add tags to]::FILES:_files' \
'*--files=[Files to add tags to]::FILES:_files' \
'*-t+[]:TAGS:_default' \
'*--tags=[]:TAGS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(a)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to add tags to]::FILES:_files' \
'*--files=[Files to add tags to]::FILES:_files' \
'*-t+[]:TAGS:_default' \
'*--tags=[]:TAGS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to remove tags from]::FILES:_files' \
'*--files=[Files to remove tags from]::FILES:_files' \
'*-t+[]:TAGS:_default' \
'*--tags=[]:TAGS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(rm)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to remove tags from]::FILES:_files' \
'*--files=[Files to remove tags from]::FILES:_files' \
'*-t+[]:TAGS:_default' \
'*--tags=[]:TAGS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(remove-raw)
_arguments "${_arguments_options[@]}" : \
'*-f+[]::FILES:_files' \
'*--files=[]::FILES:_files' \
'-h[Print help]' \
'--help[Print help]' \
':rawtags -- Raw tags to add to files:_default' \
'::file -- File:_files' \
&& ret=0
;;
(replace)
_arguments "${_arguments_options[@]}" : \
'*-f+[Files to replace tags from]::FILES:_files' \
'*--files=[Files to replace tags from]::FILES:_files' \
'*-o+[Tags to be replaced]:OLD_TAGS:_files' \
'*--old-tags=[Tags to be replaced]:OLD_TAGS:_files' \
'*-n+[Tags to replace with]:NEW_TAGS:_files' \
'*--new-tags=[Tags to replace with]:NEW_TAGS:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(deduplicate)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to deduplicate tags:_files' \
&& ret=0
;;
(dedup)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to deduplicate tags:_files' \
&& ret=0
;;
(find)
_arguments "${_arguments_options[@]}" : \
'-r[]' \
'--raw[]' \
'-H[]' \
'--hidden[]' \
'-h[Print help]' \
'--help[Print help]' \
':pattern:_default' \
'::path:_files' \
&& ret=0
;;
(fd)
_arguments "${_arguments_options[@]}" : \
'-r[]' \
'--raw[]' \
'-H[]' \
'--hidden[]' \
'-h[Print help]' \
'--help[Print help]' \
':pattern:_default' \
'::path:_files' \
&& ret=0
;;
(get-comment)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::paths:_files' \
&& ret=0
;;
(set-comment)
_arguments "${_arguments_options[@]}" : \
'*-f+[]::FILES:_files' \
'*--files=[]::FILES:_files' \
'-h[Print help]' \
'--help[Print help]' \
':comment -- Comment to add to files:_default' \
'::file -- File:_files' \
&& ret=0
;;
(get-rating)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::paths:_files' \
&& ret=0
;;
(generate-completion)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell -- Generate completions for given shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_rtag__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rtag-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(get)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(get-raw)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(set)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(set-raw)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add-raw)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove-raw)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(replace)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(deduplicate)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(find)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(get-comment)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(set-comment)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(get-rating)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(generate-completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_rtag_commands] )) ||
_rtag_commands() {
    local commands; commands=(
'list:' \
'ls:' \
'get:Get tags of files' \
'get-raw:Get raw values of the tag fields of files' \
'set:Set tags of files' \
'set-raw:Set raw strings to the tag fields of files' \
'add-raw:Append raw strings to the tag fields of files' \
'add:Deduplicate tags of given files' \
'a:Deduplicate tags of given files' \
'remove:Deduplicate tags of given files' \
'rm:Deduplicate tags of given files' \
'remove-raw:Remove raw matching strings of tag fields of files' \
'replace:Replace given tags of given files to a new set of tags' \
'deduplicate:Deduplicate tags of given files' \
'dedup:Deduplicate tags of given files' \
'find:' \
'fd:' \
'get-comment:' \
'set-comment:' \
'get-rating:' \
'generate-completion:Generate shell completion for given shell' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rtag commands' commands "$@"
}
(( $+functions[_rtag__add_commands] )) ||
_rtag__add_commands() {
    local commands; commands=()
    _describe -t commands 'rtag add commands' commands "$@"
}
(( $+functions[_rtag__add-raw_commands] )) ||
_rtag__add-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag add-raw commands' commands "$@"
}
(( $+functions[_rtag__deduplicate_commands] )) ||
_rtag__deduplicate_commands() {
    local commands; commands=()
    _describe -t commands 'rtag deduplicate commands' commands "$@"
}
(( $+functions[_rtag__find_commands] )) ||
_rtag__find_commands() {
    local commands; commands=()
    _describe -t commands 'rtag find commands' commands "$@"
}
(( $+functions[_rtag__generate-completion_commands] )) ||
_rtag__generate-completion_commands() {
    local commands; commands=()
    _describe -t commands 'rtag generate-completion commands' commands "$@"
}
(( $+functions[_rtag__get_commands] )) ||
_rtag__get_commands() {
    local commands; commands=()
    _describe -t commands 'rtag get commands' commands "$@"
}
(( $+functions[_rtag__get-comment_commands] )) ||
_rtag__get-comment_commands() {
    local commands; commands=()
    _describe -t commands 'rtag get-comment commands' commands "$@"
}
(( $+functions[_rtag__get-rating_commands] )) ||
_rtag__get-rating_commands() {
    local commands; commands=()
    _describe -t commands 'rtag get-rating commands' commands "$@"
}
(( $+functions[_rtag__get-raw_commands] )) ||
_rtag__get-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag get-raw commands' commands "$@"
}
(( $+functions[_rtag__help_commands] )) ||
_rtag__help_commands() {
    local commands; commands=(
'list:' \
'get:Get tags of files' \
'get-raw:Get raw values of the tag fields of files' \
'set:Set tags of files' \
'set-raw:Set raw strings to the tag fields of files' \
'add-raw:Append raw strings to the tag fields of files' \
'add:Deduplicate tags of given files' \
'remove:Deduplicate tags of given files' \
'remove-raw:Remove raw matching strings of tag fields of files' \
'replace:Replace given tags of given files to a new set of tags' \
'deduplicate:Deduplicate tags of given files' \
'find:' \
'get-comment:' \
'set-comment:' \
'get-rating:' \
'generate-completion:Generate shell completion for given shell' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rtag help commands' commands "$@"
}
(( $+functions[_rtag__help__add_commands] )) ||
_rtag__help__add_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help add commands' commands "$@"
}
(( $+functions[_rtag__help__add-raw_commands] )) ||
_rtag__help__add-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help add-raw commands' commands "$@"
}
(( $+functions[_rtag__help__deduplicate_commands] )) ||
_rtag__help__deduplicate_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help deduplicate commands' commands "$@"
}
(( $+functions[_rtag__help__find_commands] )) ||
_rtag__help__find_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help find commands' commands "$@"
}
(( $+functions[_rtag__help__generate-completion_commands] )) ||
_rtag__help__generate-completion_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help generate-completion commands' commands "$@"
}
(( $+functions[_rtag__help__get_commands] )) ||
_rtag__help__get_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help get commands' commands "$@"
}
(( $+functions[_rtag__help__get-comment_commands] )) ||
_rtag__help__get-comment_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help get-comment commands' commands "$@"
}
(( $+functions[_rtag__help__get-rating_commands] )) ||
_rtag__help__get-rating_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help get-rating commands' commands "$@"
}
(( $+functions[_rtag__help__get-raw_commands] )) ||
_rtag__help__get-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help get-raw commands' commands "$@"
}
(( $+functions[_rtag__help__help_commands] )) ||
_rtag__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help help commands' commands "$@"
}
(( $+functions[_rtag__help__list_commands] )) ||
_rtag__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help list commands' commands "$@"
}
(( $+functions[_rtag__help__remove_commands] )) ||
_rtag__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help remove commands' commands "$@"
}
(( $+functions[_rtag__help__remove-raw_commands] )) ||
_rtag__help__remove-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help remove-raw commands' commands "$@"
}
(( $+functions[_rtag__help__replace_commands] )) ||
_rtag__help__replace_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help replace commands' commands "$@"
}
(( $+functions[_rtag__help__set_commands] )) ||
_rtag__help__set_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help set commands' commands "$@"
}
(( $+functions[_rtag__help__set-comment_commands] )) ||
_rtag__help__set-comment_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help set-comment commands' commands "$@"
}
(( $+functions[_rtag__help__set-raw_commands] )) ||
_rtag__help__set-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag help set-raw commands' commands "$@"
}
(( $+functions[_rtag__list_commands] )) ||
_rtag__list_commands() {
    local commands; commands=()
    _describe -t commands 'rtag list commands' commands "$@"
}
(( $+functions[_rtag__remove_commands] )) ||
_rtag__remove_commands() {
    local commands; commands=()
    _describe -t commands 'rtag remove commands' commands "$@"
}
(( $+functions[_rtag__remove-raw_commands] )) ||
_rtag__remove-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag remove-raw commands' commands "$@"
}
(( $+functions[_rtag__replace_commands] )) ||
_rtag__replace_commands() {
    local commands; commands=()
    _describe -t commands 'rtag replace commands' commands "$@"
}
(( $+functions[_rtag__set_commands] )) ||
_rtag__set_commands() {
    local commands; commands=()
    _describe -t commands 'rtag set commands' commands "$@"
}
(( $+functions[_rtag__set-comment_commands] )) ||
_rtag__set-comment_commands() {
    local commands; commands=()
    _describe -t commands 'rtag set-comment commands' commands "$@"
}
(( $+functions[_rtag__set-raw_commands] )) ||
_rtag__set-raw_commands() {
    local commands; commands=()
    _describe -t commands 'rtag set-raw commands' commands "$@"
}

if [ "$funcstack[1]" = "_rtag" ]; then
    _rtag "$@"
else
    compdef _rtag rtag
fi
