#compdef dragomanctl

autoload -U is-at-least

_dragomanctl() {
    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[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_dragomanctl_commands" \
"*::: :->dragomanctl" \
&& ret=0
    case $state in
    (dragomanctl)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:dragomanctl-command-$line[1]:"
        case $line[1] in
            (translate)
_arguments "${_arguments_options[@]}" : \
'-f+[Source language (BCP-47, e.g. bg)]:SOURCE:_default' \
'--from=[Source language (BCP-47, e.g. bg)]:SOURCE:_default' \
'-t+[Target language]:TARGET:_default' \
'--to=[Target language]:TARGET:_default' \
'()--file=[Translate this document (UTF-8 text, line by line) through a file descriptor; the translation goes to --output or stdout]:FILE:_files' \
'-o+[Where --file writes the translation (stdout when absent)]:FILE:_files' \
'--output=[Where --file writes the translation (stdout when absent)]:FILE:_files' \
'--html[Treat the input as HTML and preserve markup]' \
'--no-pivot[Refuse to pivot through English]' \
'--batch[Queue behind interactive requests]' \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::text -- Text segments; stdin when empty:_default' \
&& ret=0
;;
(detect)
_arguments "${_arguments_options[@]}" : \
'*--candidates=[Only consider these languages, e.g. bg,ru,uk (default\: those of the known language pairs)]:CANDIDATES:_default' \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::text:_default' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'::key -- Setting name, e.g. memory_budget_mb:_default' \
'::value -- New value (true/false or a number); applied at once and saved:_default' \
&& ret=0
;;
(pairs)
_arguments "${_arguments_options[@]}" : \
'(--available)--installed[Only pairs installed locally]' \
'--available[Only pairs known from the provider (cached records)]' \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::pairs -- Pairs as SRC-TRG:_default' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::pairs -- Pairs as SRC-TRG:_default' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
'--check[Only report available updates]' \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(store)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_dragomanctl__subcmd__store_commands" \
"*::: :->store" \
&& ret=0

    case $state in
    (store)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:dragomanctl-store-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::pairs -- Pairs to verify; everything when empty:_default' \
&& ret=0
;;
(available)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" : \
'--root=[Target store directory (e.g. pkg/usr/share/dragomand/models)]:ROOT:_files' \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::pairs:_default' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::pairs:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_dragomanctl__subcmd__store__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:dragomanctl-store-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(available)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(completions)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(manpage)
_arguments "${_arguments_options[@]}" : \
'--json[Machine-readable JSON output]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_dragomanctl__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:dragomanctl-help-command-$line[1]:"
        case $line[1] in
            (translate)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(detect)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pairs)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(store)
_arguments "${_arguments_options[@]}" : \
":: :_dragomanctl__subcmd__help__subcmd__store_commands" \
"*::: :->store" \
&& ret=0

    case $state in
    (store)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:dragomanctl-help-store-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(available)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(manpage)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_dragomanctl_commands] )) ||
_dragomanctl_commands() {
    local commands; commands=(
'translate:Translate text (reads stdin when no TEXT is given, one segment per line), or a whole document with --file. Installs the language pair on first use' \
'detect:Identify the language of a text (stdin when no TEXT is given)' \
'config:Show the daemon configuration, one setting, or change one' \
'pairs:List language pairs' \
'install:Install (or upgrade) language pairs, e.g. bg-en' \
'remove:Remove language pairs from the user store' \
'update:Check for model updates, and install them unless --check' \
'status:Show daemon status (loaded models, memory, queue)' \
'store:Direct model-store access without the daemon (packaging, offline maintenance, debugging)' \
'completions:Print shell completions to stdout' \
'manpage:Print the man page (roff) to stdout' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'dragomanctl commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__completions_commands] )) ||
_dragomanctl__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl completions commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__config_commands] )) ||
_dragomanctl__subcmd__config_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl config commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__detect_commands] )) ||
_dragomanctl__subcmd__detect_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl detect commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help_commands] )) ||
_dragomanctl__subcmd__help_commands() {
    local commands; commands=(
'translate:Translate text (reads stdin when no TEXT is given, one segment per line), or a whole document with --file. Installs the language pair on first use' \
'detect:Identify the language of a text (stdin when no TEXT is given)' \
'config:Show the daemon configuration, one setting, or change one' \
'pairs:List language pairs' \
'install:Install (or upgrade) language pairs, e.g. bg-en' \
'remove:Remove language pairs from the user store' \
'update:Check for model updates, and install them unless --check' \
'status:Show daemon status (loaded models, memory, queue)' \
'store:Direct model-store access without the daemon (packaging, offline maintenance, debugging)' \
'completions:Print shell completions to stdout' \
'manpage:Print the man page (roff) to stdout' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'dragomanctl help commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__completions_commands] )) ||
_dragomanctl__subcmd__help__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help completions commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__config_commands] )) ||
_dragomanctl__subcmd__help__subcmd__config_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help config commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__detect_commands] )) ||
_dragomanctl__subcmd__help__subcmd__detect_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help detect commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__help_commands] )) ||
_dragomanctl__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help help commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__install_commands] )) ||
_dragomanctl__subcmd__help__subcmd__install_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help install commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__manpage_commands] )) ||
_dragomanctl__subcmd__help__subcmd__manpage_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help manpage commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__pairs_commands] )) ||
_dragomanctl__subcmd__help__subcmd__pairs_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help pairs commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__remove_commands] )) ||
_dragomanctl__subcmd__help__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help remove commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__status_commands] )) ||
_dragomanctl__subcmd__help__subcmd__status_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help status commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store_commands() {
    local commands; commands=(
'list:List every installed model in every store' \
'verify:Re-verify installed models (sizes and sha256) against their manifests. Exits 1 when anything fails' \
'available:List the pairs the provider offers and the version each would install. Contacts the provider, not the daemon' \
'install:Download and install pairs into a store directory (defaults to the user store). --root fills a system store for model packages' \
'remove:Remove pairs from the user store' \
    )
    _describe -t commands 'dragomanctl help store commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store__subcmd__available_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store__subcmd__available_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help store available commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store__subcmd__install_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store__subcmd__install_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help store install commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store__subcmd__list_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help store list commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store__subcmd__remove_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help store remove commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__store__subcmd__verify_commands] )) ||
_dragomanctl__subcmd__help__subcmd__store__subcmd__verify_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help store verify commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__translate_commands] )) ||
_dragomanctl__subcmd__help__subcmd__translate_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help translate commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__help__subcmd__update_commands] )) ||
_dragomanctl__subcmd__help__subcmd__update_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl help update commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__install_commands] )) ||
_dragomanctl__subcmd__install_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl install commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__manpage_commands] )) ||
_dragomanctl__subcmd__manpage_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl manpage commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__pairs_commands] )) ||
_dragomanctl__subcmd__pairs_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl pairs commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__remove_commands] )) ||
_dragomanctl__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl remove commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__status_commands] )) ||
_dragomanctl__subcmd__status_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl status commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store_commands] )) ||
_dragomanctl__subcmd__store_commands() {
    local commands; commands=(
'list:List every installed model in every store' \
'verify:Re-verify installed models (sizes and sha256) against their manifests. Exits 1 when anything fails' \
'available:List the pairs the provider offers and the version each would install. Contacts the provider, not the daemon' \
'install:Download and install pairs into a store directory (defaults to the user store). --root fills a system store for model packages' \
'remove:Remove pairs from the user store' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'dragomanctl store commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__available_commands] )) ||
_dragomanctl__subcmd__store__subcmd__available_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store available commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help_commands() {
    local commands; commands=(
'list:List every installed model in every store' \
'verify:Re-verify installed models (sizes and sha256) against their manifests. Exits 1 when anything fails' \
'available:List the pairs the provider offers and the version each would install. Contacts the provider, not the daemon' \
'install:Download and install pairs into a store directory (defaults to the user store). --root fills a system store for model packages' \
'remove:Remove pairs from the user store' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'dragomanctl store help commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__available_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__available_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help available commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__help_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help help commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__install_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__install_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help install commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__list_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help list commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__remove_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help remove commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__help__subcmd__verify_commands] )) ||
_dragomanctl__subcmd__store__subcmd__help__subcmd__verify_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store help verify commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__install_commands] )) ||
_dragomanctl__subcmd__store__subcmd__install_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store install commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__list_commands] )) ||
_dragomanctl__subcmd__store__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store list commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__remove_commands] )) ||
_dragomanctl__subcmd__store__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store remove commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__store__subcmd__verify_commands] )) ||
_dragomanctl__subcmd__store__subcmd__verify_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl store verify commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__translate_commands] )) ||
_dragomanctl__subcmd__translate_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl translate commands' commands "$@"
}
(( $+functions[_dragomanctl__subcmd__update_commands] )) ||
_dragomanctl__subcmd__update_commands() {
    local commands; commands=()
    _describe -t commands 'dragomanctl update commands' commands "$@"
}

if [ "$funcstack[1]" = "_dragomanctl" ]; then
    _dragomanctl "$@"
else
    compdef _dragomanctl dragomanctl
fi
