#compdef shiny-mirrors

autoload -U is-at-least

_shiny-mirrors() {
    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[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_shiny-mirrors_commands" \
"*::: :->shiny-mirrors" \
&& ret=0
    case $state in
    (shiny-mirrors)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:shiny-mirrors-command-$line[1]:"
        case $line[1] in
            (refresh)
_arguments "${_arguments_options[@]}" : \
'(-u --updated-only)-l+[Maximum last sync duration (Hours, Int) \[default\: 24\]]:LAST_SYNC:_default' \
'(-u --updated-only)--last-sync=[Maximum last sync duration (Hours, Int) \[default\: 24\]]:LAST_SYNC:_default' \
'-p+[Which IP version the mirror has to support]:IPV:(v4 v6)' \
'--ipv=[Which IP version the mirror has to support]:IPV:(v4 v6)' \
'-m+[Maximum of mirrors to write to local mirror list]:MAX:_default' \
'--max=[Maximum of mirrors to write to local mirror list]:MAX:_default' \
'-t+[Time before a benchmark of each mirror timeouts (Seconds, Float) \[default\: Small 3, Medium 10, Big 30\]]:TIMEOUT:_default' \
'--timeout=[Time before a benchmark of each mirror timeouts (Seconds, Float) \[default\: Small 3, Medium 10, Big 30\]]:TIMEOUT:_default' \
'-f+[Size of a file the speed measured is with \[default\: Small\]]:FILE_SIZE:(Small Medium Big)' \
'--file-size=[Size of a file the speed measured is with \[default\: Small\]]:FILE_SIZE:(Small Medium Big)' \
'-M+[If to measure only transfer time or total time \[default\: Total\]]:MEASURE_METHOD:(Total Transfer)' \
'--measure-method=[If to measure only transfer time or total time \[default\: Total\]]:MEASURE_METHOD:(Total Transfer)' \
'-L+[Rank only N most recently synced mirrors]:LIMIT:_default' \
'--limit=[Rank only N most recently synced mirrors]:LIMIT:_default' \
'-d[Don'\''t actually write the found mirrors to a local mirror list]' \
'--dry-run[Don'\''t actually write the found mirrors to a local mirror list]' \
'-u[Find mirrors which are uptodate, ignore max last sync]' \
'--updated-only[Find mirrors which are uptodate, ignore max last sync]' \
'-i[Interactively select which mirrors you want to write to local mirror list]' \
'--interactive[Interactively select which mirrors you want to write to local mirror list]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_shiny-mirrors__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

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

(( $+functions[_shiny-mirrors_commands] )) ||
_shiny-mirrors_commands() {
    local commands; commands=(
'refresh:Get the perfect mirrors for you' \
'status:Show status of mirrors you are using' \
'config:Show the settings read from the config file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__config_commands] )) ||
_shiny-mirrors__subcmd__config_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors config commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__help_commands] )) ||
_shiny-mirrors__subcmd__help_commands() {
    local commands; commands=(
'refresh:Get the perfect mirrors for you' \
'status:Show status of mirrors you are using' \
'config:Show the settings read from the config file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__help__subcmd__config_commands] )) ||
_shiny-mirrors__subcmd__help__subcmd__config_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help config commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__help__subcmd__help_commands] )) ||
_shiny-mirrors__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__help__subcmd__refresh_commands] )) ||
_shiny-mirrors__subcmd__help__subcmd__refresh_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help refresh commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__help__subcmd__status_commands] )) ||
_shiny-mirrors__subcmd__help__subcmd__status_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help status commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__refresh_commands] )) ||
_shiny-mirrors__subcmd__refresh_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors refresh commands' commands "$@"
}
(( $+functions[_shiny-mirrors__subcmd__status_commands] )) ||
_shiny-mirrors__subcmd__status_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors status commands' commands "$@"
}

if [ "$funcstack[1]" = "_shiny-mirrors" ]; then
    _shiny-mirrors "$@"
else
    compdef _shiny-mirrors shiny-mirrors
fi
