# 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_compgen_w_replacement() {
  local cur word append=0

  [[ "$1" == "-a" ]] && { shift; append=1; }
  [[ "$1" == "--" ]] && { shift; }

  cur="$1"
  shift

  (( append )) || COMPREPLY=()

  for word; do
    if [[ "$word" == "$cur"* ]]; then
      COMPREPLY+=("$(printf '%q' "$word")")
    fi
  done
}

_go-sendxmpp_prefix_compreply() {
  local i=0 prefix="$1"
  for ((i=0; i < ${#COMPREPLY[@]}; ++i)); do
    COMPREPLY[i]="$prefix${COMPREPLY[i]}"
  done
}

_go-sendxmpp_exec() {
  local item desc

  while IFS=$'\t' read -r item desc; do
    if [[ "$item" == "$cur"* ]]; then
      COMPREPLY+=("$(printf '%q' "$item")")
    fi
  done < <(eval "$1")
}

_go-sendxmpp_parse_commandline() {
  POSITIONALS=()
  END_OF_OPTIONS=0
  POSITIONAL_NUM=0

  local cmd="${words[0]}" argi arg i char trailing_chars

  for ((argi=1; argi < ${#words[@]} - 1; ++argi)); do
    arg="${words[argi]}"

    case "$arg" in
      --)
        END_OF_OPTIONS=1
        for ((++argi; argi < ${#words[@]}; ++argi)); do
          POSITIONALS[POSITIONAL_NUM++]="${words[argi]}"
        done
        break;;
      -)
        POSITIONALS[POSITIONAL_NUM++]="-";;
      -*)
        case "$cmd" in go-sendxmpp)
          case "$arg" in
            --help)
              OPT_help+=(_OPT_ISSET_)
              continue;;
            --version)
              OPT_version+=(_OPT_ISSET_)
              continue;;
            --alias)
              OPT_alias+=("${words[++argi]}")
              continue;;
            --alias=*)
              OPT_alias+=("${arg#*=}")
              continue;;
            --chatroom)
              OPT_chatroom+=(_OPT_ISSET_)
              continue;;
            --debug)
              OPT_debug+=(_OPT_ISSET_)
              continue;;
            --fast-off)
              OPT_fast_off+=(_OPT_ISSET_)
              continue;;
            --file)
              OPT_file+=("${words[++argi]}")
              continue;;
            --file=*)
              OPT_file+=("${arg#*=}")
              continue;;
            --headline)
              OPT_headline+=(_OPT_ISSET_)
              continue;;
            --http-upload)
              OPT_http_upload+=("${words[++argi]}")
              continue;;
            --http-upload=*)
              OPT_http_upload+=("${arg#*=}")
              continue;;
            --interactive)
              OPT_interactive+=(_OPT_ISSET_)
              continue;;
            --jserver)
              OPT_jserver+=("${words[++argi]}")
              continue;;
            --jserver=*)
              OPT_jserver+=("${arg#*=}")
              continue;;
            --listen)
              OPT_listen+=(_OPT_ISSET_)
              continue;;
            --message)
              OPT_message+=("${words[++argi]}")
              continue;;
            --message=*)
              OPT_message+=("${arg#*=}")
              continue;;
            --muc-password)
              OPT_muc_password+=("${words[++argi]}")
              continue;;
            --muc-password=*)
              OPT_muc_password+=("${arg#*=}")
              continue;;
            --no-tls-verify)
              OPT_no_tls_verify+=(_OPT_ISSET_)
              continue;;
            --oob-file)
              OPT_oob_file+=("${words[++argi]}")
              continue;;
            --oob-file=*)
              OPT_oob_file+=("${arg#*=}")
              continue;;
            --ox)
              OPT_ox+=(_OPT_ISSET_)
              continue;;
            --ox-delete-nodes)
              OPT_ox_delete_nodes+=(_OPT_ISSET_)
              continue;;
            --ox-genprivkey-rsa)
              OPT_ox_genprivkey_rsa+=(_OPT_ISSET_)
              continue;;
            --ox-genprivkey-x25519)
              OPT_ox_genprivkey_x25519+=(_OPT_ISSET_)
              continue;;
            --ox-import-privkey)
              OPT_ox_import_privkey+=("${words[++argi]}")
              continue;;
            --ox-import-privkey=*)
              OPT_ox_import_privkey+=("${arg#*=}")
              continue;;
            --ox-passphrase)
              OPT_ox_passphrase+=("${words[++argi]}")
              continue;;
            --ox-passphrase=*)
              OPT_ox_passphrase+=("${arg#*=}")
              continue;;
            --password)
              OPT_password+=("${words[++argi]}")
              continue;;
            --password=*)
              OPT_password+=("${arg#*=}")
              continue;;
            --raw)
              OPT_raw+=(_OPT_ISSET_)
              continue;;
            --scram-mech-pinning)
              OPT_scram_mech_pinning+=("${words[++argi]}")
              continue;;
            --scram-mech-pinning=*)
              OPT_scram_mech_pinning+=("${arg#*=}")
              continue;;
            --ssdp-off)
              OPT_ssdp_off+=(_OPT_ISSET_)
              continue;;
            --subject)
              OPT_subject+=("${words[++argi]}")
              continue;;
            --subject=*)
              OPT_subject+=("${arg#*=}")
              continue;;
            --timeout)
              OPT_timeout+=("${words[++argi]}")
              continue;;
            --timeout=*)
              OPT_timeout+=("${arg#*=}")
              continue;;
            --tls)
              OPT_tls+=(_OPT_ISSET_)
              continue;;
            --tls-version)
              OPT_tls_version+=("${words[++argi]}")
              continue;;
            --tls-version=*)
              OPT_tls_version+=("${arg#*=}")
              continue;;
            --username)
              OPT_username+=("${words[++argi]}")
              continue;;
            --username=*)
              OPT_username+=("${arg#*=}")
              continue;;
          esac
        esac
        for ((i=1; i < ${#arg}; ++i)); do
          char="${arg:$i:1}"
          trailing_chars="${arg:$((i + 1))}"
          case "$cmd" in go-sendxmpp)
            case "$char" in
              a)
                if [[ -n "$trailing_chars" ]]
                then OPT_alias+=("$trailing_chars")
                else OPT_alias+=("${words[++argi]}")
                fi
                continue 2;;
              c)
                OPT_chatroom+=(_OPT_ISSET_);;
              d)
                OPT_debug+=(_OPT_ISSET_);;
              f)
                if [[ -n "$trailing_chars" ]]
                then OPT_file+=("$trailing_chars")
                else OPT_file+=("${words[++argi]}")
                fi
                continue 2;;
              h)
                if [[ -n "$trailing_chars" ]]
                then OPT_http_upload+=("$trailing_chars")
                else OPT_http_upload+=("${words[++argi]}")
                fi
                continue 2;;
              i)
                OPT_interactive+=(_OPT_ISSET_);;
              j)
                if [[ -n "$trailing_chars" ]]
                then OPT_jserver+=("$trailing_chars")
                else OPT_jserver+=("${words[++argi]}")
                fi
                continue 2;;
              l)
                OPT_listen+=(_OPT_ISSET_);;
              m)
                if [[ -n "$trailing_chars" ]]
                then OPT_message+=("$trailing_chars")
                else OPT_message+=("${words[++argi]}")
                fi
                continue 2;;
              n)
                OPT_no_tls_verify+=(_OPT_ISSET_);;
              p)
                if [[ -n "$trailing_chars" ]]
                then OPT_password+=("$trailing_chars")
                else OPT_password+=("${words[++argi]}")
                fi
                continue 2;;
              s)
                if [[ -n "$trailing_chars" ]]
                then OPT_subject+=("$trailing_chars")
                else OPT_subject+=("${words[++argi]}")
                fi
                continue 2;;
              t)
                OPT_tls+=(_OPT_ISSET_);;
              u)
                if [[ -n "$trailing_chars" ]]
                then OPT_username+=("$trailing_chars")
                else OPT_username+=("${words[++argi]}")
                fi
                continue 2;;
            esac
          esac
        done;;
      *)
        POSITIONALS[POSITIONAL_NUM++]="$arg"
        ;;
    esac
  done

  for ((; argi < ${#words[@]}; ++argi)); do
    arg="${words[$argi]}"

    case "$arg" in
      -) POSITIONALS[POSITIONAL_NUM++]="$arg";;
      -*);;
      *) POSITIONALS[POSITIONAL_NUM++]="$arg";;
    esac
  done
}

_go_sendxmpp() {
  local cur prev words cword split
  _init_completion -n = || return

  local END_OF_OPTIONS POSITIONALS POSITIONAL_NUM
  local -a OPT_help OPT_version OPT_alias OPT_chatroom OPT_debug OPT_fast_off OPT_file OPT_headline OPT_http_upload OPT_interactive OPT_jserver OPT_listen OPT_message OPT_muc_password OPT_no_tls_verify OPT_oob_file OPT_ox OPT_ox_delete_nodes OPT_ox_genprivkey_rsa OPT_ox_genprivkey_x25519 OPT_ox_import_privkey OPT_ox_passphrase OPT_password OPT_raw OPT_scram_mech_pinning OPT_ssdp_off OPT_subject OPT_timeout OPT_tls OPT_tls_version OPT_username

  _go-sendxmpp_parse_commandline

  __complete_option() {
    local opt="$1" cur="$2" mode="$3"

    case "$opt" in
      --alias|-a|--jserver|-j|--muc-password|--oob-file|--ox-passphrase|--password|-p|--subject|-s|--timeout|--username|-u)
        return 0;;
      --file|-f|--http-upload|-h|--message|-m|--ox-import-privkey)
        _filedir
        return 0;;
      --scram-mech-pinning)
        _go-sendxmpp_compgen_w_replacement -- "$cur" SCRAM-SHA-1 SCRAM-SHA-1-PLUS SCRAM-SHA-256 SCRAM-SHA-256-PLUS SCRAM-SHA-512 SCRAM-SHA-512-PLUS
        return 0;;
      --tls-version)
        _go-sendxmpp_compgen_w_replacement -- "$cur" 10 11 12 13
        return 0;;
    esac

    return 1
  }

  case "$prev" in
    --*)
      __complete_option "$prev" "$cur" WITHOUT_OPTIONALS && return 0;;
    -*)
      case "$prev" in -*([cdilnt])[afhjmpsu])
        __complete_option "-${prev: -1}" "$cur" WITHOUT_OPTIONALS && return 0
      esac;;
  esac

  case "$cur" in
    --*=*)
      __complete_option "${cur%%=*}" "${cur#*=}" WITH_OPTIONALS && return 0;;
    -*=*);;
    --*);;
    -*)
        local i
        for ((i=2; i <= ${#cur}; ++i)); do
          local pre="${cur:0:$i}" value="${cur:$i}"
          __complete_option "-${pre: -1}" "$value" WITH_OPTIONALS && {
            _go-sendxmpp_prefix_compreply "$pre"
            return 0
          }
        done;;
  esac

  if (( ! END_OF_OPTIONS )) && [[ "$cur" = -* ]]; then
    local -a opts=()
    (( ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--help)
    (( ! ${#OPT_version} && ! ${#OPT_help} )) && opts+=(--version)
    (( ! ${#OPT_alias} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-a --alias=)
    (( ! ${#OPT_chatroom} && ! ${#OPT_ox} && ! ${#OPT_headline} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-c --chatroom)
    (( ! ${#OPT_debug} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-d --debug)
    (( ! ${#OPT_fast_off} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--fast-off)
    (( ! ${#OPT_file} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-f --file=)
    (( ! ${#OPT_headline} && ! ${#OPT_ox} && ! ${#OPT_chatroom} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--headline)
    (( ! ${#OPT_http_upload} && ! ${#OPT_ox} && ! ${#OPT_interactive} && ! ${#OPT_message} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-h --http-upload=)
    (( ! ${#OPT_interactive} && ! ${#OPT_http_upload} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-i --interactive)
    (( ! ${#OPT_jserver} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-j --jserver=)
    (( ! ${#OPT_listen} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-l --listen)
    (( ! ${#OPT_message} && ! ${#OPT_http_upload} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-m --message=)
    (( ! ${#OPT_muc_password} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--muc-password=)
    (( ! ${#OPT_no_tls_verify} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-n --no-tls-verify)
    (( ! ${#OPT_oob_file} && ! ${#OPT_ox} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--oob-file=)
    (( ! ${#OPT_ox} && ! ${#OPT_http_upload} && ! ${#OPT_chatroom} && ! ${#OPT_oob_file} && ! ${#OPT_headline} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox)
    (( ! ${#OPT_ox_delete_nodes} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox-delete-nodes)
    (( ! ${#OPT_ox_genprivkey_rsa} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox-genprivkey-rsa)
    (( ! ${#OPT_ox_genprivkey_x25519} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox-genprivkey-x25519)
    (( ! ${#OPT_ox_import_privkey} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox-import-privkey=)
    (( ! ${#OPT_ox_passphrase} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ox-passphrase=)
    (( ! ${#OPT_password} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-p --password=)
    (( ! ${#OPT_raw} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--raw)
    (( ! ${#OPT_scram_mech_pinning} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--scram-mech-pinning=)
    (( ! ${#OPT_ssdp_off} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--ssdp-off)
    (( ! ${#OPT_subject} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-s --subject=)
    (( ! ${#OPT_timeout} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--timeout=)
    (( ! ${#OPT_tls} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-t --tls)
    (( ! ${#OPT_tls_version} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(--tls-version=)
    (( ! ${#OPT_username} && ! ${#OPT_help} && ! ${#OPT_version} )) && opts+=(-u --username=)
    _go-sendxmpp_compgen_w_replacement -a -- "$cur" "${opts[@]}"
    [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
    return 1
  fi

  test "$POSITIONAL_NUM" -ge 1 && {
    _go-sendxmpp_exec _go-sendxmpp_jid_from_history
    return 0;
  }

  return 1
}

complete -F _go_sendxmpp go-sendxmpp

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