#compdef go-sendxmpp

# This script was generated by crazy-complete.
# crazy-complete: A tool that creates robust and reliable autocompletion scripts for Bash, Fish and Zsh.
# For more information, visit: https://github.com/crazy-complete/crazy-complete

_go-sendxmpp_jid_from_history() {
  command grep go-sendxmpp "$HISTFILE" | command grep -E -o '[^ ]+@[^ ]+(/[^ ]+)?' | command sort | command uniq
}

_go-sendxmpp__--tls-version() {
  local -a items=(
    10:TLSv1.0
    11:TLSv1.1
    12:TLSv1.2
    13:TLSv1.3
  )

  _describe -- version items
}

_go-sendxmpp_exec() {
  local -a describe=()
  local item='' desc=''

  while IFS=$'\t' read -r item desc; do
    item="${item/:/\\:/}"
    describe+=("$item:$desc")
  done < <(eval "$1")

  _describe '' describe
}

_go_sendxmpp() {
  local -a args=(
    '(- *)'--help'[Show help]'
    '(- *)'--version'[Show version information]'
    '(--alias -a)'{-a+,--alias=}'[Set alias/nickname for chatrooms]':alias:' '
    '(--headline --ox --chatroom -c)'{-c,--chatroom}'[Send message to a chatroom]'
    '(--debug -d)'{-d,--debug}'[Show debugging info]'
    '(--fast-off)'--fast-off'[Disable XEP-0484\: Fast Authentication Streamlining Tokens]'
    '(--file -f)'{-f+,--file=}'[Set configuration file (Default\: ~/.config/go-sendxmpp/sendxmpprc)]':config-file:_files
    '(--chatroom --ox -c --headline)'--headline'[Send message as type headline]'
    '(--interactive --message --ox -i -m --http-upload -h)'{-h+,--http-upload=}'[Send a file via http-upload]':file:_files
    '(--http-upload -h --interactive -i)'{-i,--interactive}"[Interactive mode (for use with e.g. 'tail -f')]"
    '(--jserver -j)'{-j+,--jserver=}'[XMPP server address]':address:' '
    '(--listen -l)'{-l,--listen}'[Listen for messages and print them to stdout]'
    '(--http-upload -h --message -m)'{-m+,--message=}'[Set file including the message]':message-file:_files
    '(--muc-password)'--muc-password='[Password for password protected MUCs]':muc-password:' '
    '(--no-tls-verify -n)'{-n,--no-tls-verify}'[Skip verification of TLS certificates (not recommended)]'
    '(--ox --oob-file)'--oob-file='[URL to send a file as out of band data]':url:' '
    '(--chatroom --headline --http-upload --oob-file -c -h --ox)'--ox'[Use "OpenPGP for XMPP" encryption (experimental)]'
    '(--ox-delete-nodes)'--ox-delete-nodes'[Delete existing OpenPGP nodes on the server]'
    '(--ox-genprivkey-rsa)'--ox-genprivkey-rsa'[Generate a private OpenPGP key (RSA 4096 bit) for the given JID and publish the corresponding public key]'
    '(--ox-genprivkey-x25519)'--ox-genprivkey-x25519'[Generate a private OpenPGP key (x25519) for the given JID and publish the corresponding public key]'
    '(--ox-import-privkey)'--ox-import-privkey='[Import an existing private OpenPGP key]':file:_files
    '(--ox-passphrase)'--ox-passphrase='[Passphrase for locking and unlocking the private OpenPGP key]':passphrase:' '
    '(--password -p)'{-p+,--password=}'[Password for XMPP account]':password:' '
    '(--raw)'--raw'[Send raw XML]'
    '(--scram-mech-pinning)'--scram-mech-pinning='[Enforce the use of a certain SCRAM authentication mechanism]':value:'(SCRAM-SHA-1 SCRAM-SHA-1-PLUS SCRAM-SHA-256 SCRAM-SHA-256-PLUS SCRAM-SHA-512 SCRAM-SHA-512-PLUS)'
    '(--ssdp-off)'--ssdp-off'[Disable XEP-0474\: SASL SCRAM Downgrade Protection]'
    '(--subject -s)'{-s+,--subject=}'[Set message subject]':subject:' '
    '(--timeout)'--timeout='[Connection timeout in seconds \[default\: 10\]]':seconds:' '
    '(--tls -t)'{-t,--tls}'[Use direct TLS]'
    '(--tls-version)'--tls-version='[Minimal TLS version\: 10 (TLSv1.0), 11 (TLSv1.1), 12 (TLSv1.2) or 13 (TLSv1.3) \[default\: 12\]]':version:_go-sendxmpp__--tls-version
    '(--username -u)'{-u+,--username=}'[Username for XMPP account]':username:' '
    '*':'Specify JID':'{_go-sendxmpp_exec _go-sendxmpp_jid_from_history}'
  )
  _arguments -S -s -w "${args[@]}"
}

_go_sendxmpp "$@"

# vim: ft=zsh ts=2 sts=2 sw=2 et