#compdef wyrmyon

autoload -U is-at-least

_wyrmyon() {
    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[@]}" : \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'()--update[Replace this copy with the latest release, unless a package manager installed it]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::targets -- Paths to send, or a code to receive:_default' \
":: :_wyrmyon_commands" \
"*::: :->wyrmyon" \
&& ret=0
    case $state in
    (wyrmyon)
        words=($line[2] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:wyrmyon-command-$line[2]:"
        case $line[2] in
            (send)
_arguments "${_arguments_options[@]}" : \
'--text=[Text to send; \`-\` reads it from stdin]:TEXT:_default' \
'--code-length=[Number of words in the generated code]:CODE_LENGTH:_default' \
'(--code-length)--code=[Use this code instead of generating one, e.g. the one a receiver chose]:CODE:_default' \
'--times=[Serve this many receivers with the same code, one after another]:TIMES:_default' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'-R[Keep each path as typed, not only its last name, like \`rsync -R\`]' \
'--relative[Keep each path as typed, not only its last name, like \`rsync -R\`]' \
'--qr[Also show the code as a QR code, for a phone to scan]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::paths -- Files or directories to send; several travel as one bundle, and land side by side:_files' \
&& ret=0
;;
(tx)
_arguments "${_arguments_options[@]}" : \
'--text=[Text to send; \`-\` reads it from stdin]:TEXT:_default' \
'--code-length=[Number of words in the generated code]:CODE_LENGTH:_default' \
'(--code-length)--code=[Use this code instead of generating one, e.g. the one a receiver chose]:CODE:_default' \
'--times=[Serve this many receivers with the same code, one after another]:TIMES:_default' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'-R[Keep each path as typed, not only its last name, like \`rsync -R\`]' \
'--relative[Keep each path as typed, not only its last name, like \`rsync -R\`]' \
'--qr[Also show the code as a QR code, for a phone to scan]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::paths -- Files or directories to send; several travel as one bundle, and land side by side:_files' \
&& ret=0
;;
(receive)
_arguments "${_arguments_options[@]}" : \
'--code-length=[Number of words in the code\: the one \`--new\` allocates, or the one the prompt completes]:CODE_LENGTH:_default' \
'-o+[Where to write a received file or directory, instead of its name in the current directory; for several paths (or \`send -R\`), the directory they land in, created if missing]:OUTPUT_FILE:_files' \
'--output-file=[Where to write a received file or directory, instead of its name in the current directory; for several paths (or \`send -R\`), the directory they land in, created if missing]:OUTPUT_FILE:_files' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--new[Allocate a code here, for the sender to use with \`send --code\`]' \
'--allocate[Allocate a code here, for the sender to use with \`send --code\`]' \
'--accept-file[Accept a file or directory without asking]' \
'--overwrite[Replace what is already at the destination, once the new data is complete; never a directory]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
'::code -- The code the sender gave you; asked for when left out:_default' \
&& ret=0
;;
(rx)
_arguments "${_arguments_options[@]}" : \
'--code-length=[Number of words in the code\: the one \`--new\` allocates, or the one the prompt completes]:CODE_LENGTH:_default' \
'-o+[Where to write a received file or directory, instead of its name in the current directory; for several paths (or \`send -R\`), the directory they land in, created if missing]:OUTPUT_FILE:_files' \
'--output-file=[Where to write a received file or directory, instead of its name in the current directory; for several paths (or \`send -R\`), the directory they land in, created if missing]:OUTPUT_FILE:_files' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--new[Allocate a code here, for the sender to use with \`send --code\`]' \
'--allocate[Allocate a code here, for the sender to use with \`send --code\`]' \
'--accept-file[Accept a file or directory without asking]' \
'--overwrite[Replace what is already at the destination, once the new data is complete; never a directory]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
'::code -- The code the sender gave you; asked for when left out:_default' \
&& ret=0
;;
(netcheck)
_arguments "${_arguments_options[@]}" : \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(shim)
_arguments "${_arguments_options[@]}" : \
'--dir=[Where the link goes\: by default beside this binary when that is writable, else ~/.local/bin]:DIR:_files' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--remove[Remove a wormhole link that runs wyrmyon, and nothing else]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(ssh)
_arguments "${_arguments_options[@]}" : \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_wyrmyon__subcmd__ssh_commands" \
"*::: :->ssh" \
&& ret=0

    case $state in
    (ssh)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:wyrmyon-ssh-command-$line[1]:"
        case $line[1] in
            (invite)
_arguments "${_arguments_options[@]}" : \
'-c+[Number of words in the code]:NUMWORDS:_default' \
'--code-length=[Number of words in the code]:NUMWORDS:_default' \
'-u+[Add to the \`authorized_keys\` of USER (Unix only)]:USER:_default' \
'--user=[Add to the \`authorized_keys\` of USER (Unix only)]:USER:_default' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(accept)
_arguments "${_arguments_options[@]}" : \
'-F+[The public key file to send, or a directory to look for one in; by default \`~/.ssh\`]:PATH:_files' \
'--key-file=[The public key file to send, or a directory to look for one in; by default \`~/.ssh\`]:PATH:_files' \
'--relay-url=[Mailbox server to meet the peer on]:RELAY_URL:_default' \
'--transit-helper=[Transit relay to fall back on when a direct connection fails]:TRANSIT_HELPER:_default' \
'--iroh-relays=[iroh relays\: \`default\` (n0'\''s public ones), \`disabled\` (direct connections only), or relay URLs separated by commas]:IROH_RELAYS:_default' \
'-y[Send the key without asking]' \
'--yes[Send the key without asking]' \
'--no-listen[Do not accept inbound connections\: connect out, or through the relay]' \
'--hide-progress[Do not show progress bars]' \
'--ascii[Draw progress bars and QR codes with ASCII characters only]' \
'(--force-iroh)--force-classic[Never use the iroh-v1 transport, even with another wyrmyon]' \
'--force-iroh[Fail rather than fall back to classic transit with a legacy peer]' \
'-h[Print help]' \
'--help[Print help]' \
':code -- The code from `ssh invite`:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_wyrmyon__subcmd__ssh__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

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

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:wyrmyon-help-command-$line[1]:"
        case $line[1] in
            (send)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(receive)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(netcheck)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shim)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(ssh)
_arguments "${_arguments_options[@]}" : \
":: :_wyrmyon__subcmd__help__subcmd__ssh_commands" \
"*::: :->ssh" \
&& ret=0

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

(( $+functions[_wyrmyon_commands] )) ||
_wyrmyon_commands() {
    local commands; commands=(
'send:Send text, a file, a directory, or several paths as one bundle' \
'tx:Send text, a file, a directory, or several paths as one bundle' \
'receive:Receive what the other side sends' \
'rx:Receive what the other side sends' \
'netcheck:Check how this network lets iroh connect\: public address, NAT, port mapping, relays' \
'shim:Link \`wormhole\` to wyrmyon, so what calls the Python client runs this one' \
'ssh:Hand an SSH public key over, into the other side'\''s \`authorized_keys\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'wyrmyon commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help_commands] )) ||
_wyrmyon__subcmd__help_commands() {
    local commands; commands=(
'send:Send text, a file, a directory, or several paths as one bundle' \
'receive:Receive what the other side sends' \
'netcheck:Check how this network lets iroh connect\: public address, NAT, port mapping, relays' \
'shim:Link \`wormhole\` to wyrmyon, so what calls the Python client runs this one' \
'ssh:Hand an SSH public key over, into the other side'\''s \`authorized_keys\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'wyrmyon help commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__help_commands] )) ||
_wyrmyon__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help help commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__netcheck_commands] )) ||
_wyrmyon__subcmd__help__subcmd__netcheck_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help netcheck commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__receive_commands] )) ||
_wyrmyon__subcmd__help__subcmd__receive_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help receive commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__send_commands] )) ||
_wyrmyon__subcmd__help__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help send commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__shim_commands] )) ||
_wyrmyon__subcmd__help__subcmd__shim_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help shim commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__ssh_commands] )) ||
_wyrmyon__subcmd__help__subcmd__ssh_commands() {
    local commands; commands=(
'invite:Wait for an SSH public key and add it to an \`authorized_keys\` file' \
'accept:Send your SSH public key, in answer to \`ssh invite\`' \
    )
    _describe -t commands 'wyrmyon help ssh commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__ssh__subcmd__accept_commands] )) ||
_wyrmyon__subcmd__help__subcmd__ssh__subcmd__accept_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help ssh accept commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__help__subcmd__ssh__subcmd__invite_commands] )) ||
_wyrmyon__subcmd__help__subcmd__ssh__subcmd__invite_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon help ssh invite commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__netcheck_commands] )) ||
_wyrmyon__subcmd__netcheck_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon netcheck commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__receive_commands] )) ||
_wyrmyon__subcmd__receive_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon receive commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__send_commands] )) ||
_wyrmyon__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon send commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__shim_commands] )) ||
_wyrmyon__subcmd__shim_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon shim commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh_commands] )) ||
_wyrmyon__subcmd__ssh_commands() {
    local commands; commands=(
'invite:Wait for an SSH public key and add it to an \`authorized_keys\` file' \
'accept:Send your SSH public key, in answer to \`ssh invite\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'wyrmyon ssh commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__accept_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__accept_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon ssh accept commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__help_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__help_commands() {
    local commands; commands=(
'invite:Wait for an SSH public key and add it to an \`authorized_keys\` file' \
'accept:Send your SSH public key, in answer to \`ssh invite\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'wyrmyon ssh help commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__help__subcmd__accept_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__help__subcmd__accept_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon ssh help accept commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__help__subcmd__help_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon ssh help help commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__help__subcmd__invite_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__help__subcmd__invite_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon ssh help invite commands' commands "$@"
}
(( $+functions[_wyrmyon__subcmd__ssh__subcmd__invite_commands] )) ||
_wyrmyon__subcmd__ssh__subcmd__invite_commands() {
    local commands; commands=()
    _describe -t commands 'wyrmyon ssh invite commands' commands "$@"
}

if [ "$funcstack[1]" = "_wyrmyon" ]; then
    _wyrmyon "$@"
else
    compdef _wyrmyon wyrmyon
fi
