#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[@]}" \
'-l+[Maximum last sync duration (Hours, Int)]:LAST_SYNC: ' \
'--last-sync=[Maximum last sync duration (Hours, Int)]:LAST_SYNC: ' \
'-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: ' \
'--max=[Maximum of mirrors to write to local mirror list]:MAX: ' \
'-t+[Time before a benchmark of each mirror timeouts (Seconds, Float)]:TIMEOUT: ' \
'--timeout=[Time before a benchmark of each mirror timeouts (Seconds, Float)]:TIMEOUT: ' \
'-f+[Size of a file the speed measured is with]:FILE_SIZE:(big medium small)' \
'--file-size=[Size of a file the speed measured is with]:FILE_SIZE:(big medium small)' \
'-M+[If to measure only transfer time or total time]:MEASURE_METHOD:(total transfer)' \
'--measure-method=[If to measure only transfer time or total time]:MEASURE_METHOD:(total transfer)' \
'-L+[Rank only N most recently synced mirrors]:LIMIT: ' \
'--limit=[Rank only N most recently synced mirrors]:LIMIT: ' \
'-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[@]}" \
'(-b --branch -p --protocol -C --continent -c --country)*--protocol-value=[]' \
'(-b --branch -p --protocol -C --continent -c --country)--branch-value=[]' \
'(-b --branch -p --protocol -C --continent -c --country)*--country-value=[]' \
'(-b --branch -p --protocol -C --continent -c --country)--continent-value=[]' \
'(-b --branch -p --protocol -C --continent -c --country --branch-value --country-value --continent-value --protocol-value)-s[Set all settings options]' \
'(-b --branch -p --protocol -C --continent -c --country --branch-value --country-value --continent-value --protocol-value)--setup[Set all settings options]' \
'-c[Set a list of countries to filter with]' \
'--country[Set a list of countries to filter with]' \
'-b[Set a branch to filter with]' \
'--branch[Set a branch to filter with]' \
'-C[Set a continent to filter with]' \
'--continent[Set a continent to filter with]' \
'-p[Set a list of protocols to filter with]' \
'--protocol[Set a list of protocols to filter with]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_shiny-mirrors__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:shiny-mirrors-config-command-$line[1]:"
        case $line[1] in
            (show)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_shiny-mirrors__config__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:shiny-mirrors-config-help-command-$line[1]:"
        case $line[1] in
            (show)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_shiny-mirrors__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[@]}" \
":: :_shiny-mirrors__help__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:shiny-mirrors-help-config-command-$line[1]:"
        case $line[1] in
            (show)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
(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:Settings manipulation and magic' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors commands' commands "$@"
}
(( $+functions[_shiny-mirrors__config_commands] )) ||
_shiny-mirrors__config_commands() {
    local commands; commands=(
'show:Show the settings' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors config commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help__config_commands] )) ||
_shiny-mirrors__help__config_commands() {
    local commands; commands=(
'show:Show the settings' \
    )
    _describe -t commands 'shiny-mirrors help config commands' commands "$@"
}
(( $+functions[_shiny-mirrors__config__help_commands] )) ||
_shiny-mirrors__config__help_commands() {
    local commands; commands=(
'show:Show the settings' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors config help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__config__help__help_commands] )) ||
_shiny-mirrors__config__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors config help help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help_commands] )) ||
_shiny-mirrors__help_commands() {
    local commands; commands=(
'refresh:Get the perfect mirrors for you' \
'status:Show status of mirrors you are using' \
'config:Settings manipulation and magic' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'shiny-mirrors help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help__help_commands] )) ||
_shiny-mirrors__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help help commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help__refresh_commands] )) ||
_shiny-mirrors__help__refresh_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help refresh commands' commands "$@"
}
(( $+functions[_shiny-mirrors__refresh_commands] )) ||
_shiny-mirrors__refresh_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors refresh commands' commands "$@"
}
(( $+functions[_shiny-mirrors__config__help__show_commands] )) ||
_shiny-mirrors__config__help__show_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors config help show commands' commands "$@"
}
(( $+functions[_shiny-mirrors__config__show_commands] )) ||
_shiny-mirrors__config__show_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors config show commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help__config__show_commands] )) ||
_shiny-mirrors__help__config__show_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help config show commands' commands "$@"
}
(( $+functions[_shiny-mirrors__help__status_commands] )) ||
_shiny-mirrors__help__status_commands() {
    local commands; commands=()
    _describe -t commands 'shiny-mirrors help status commands' commands "$@"
}
(( $+functions[_shiny-mirrors__status_commands] )) ||
_shiny-mirrors__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
