# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab



_shtab_streamlink_option_strings=(-h --help -V --version --version-check --auto-version-check --config --no-config --locale -l --loglevel --logformat --logdateformat --logfile -Q --quiet -j --json --plugins --show-matchers --can-handle-url --can-handle-url-no-redirect --no-plugin-cache --no-plugin-sideloading --plugin-dir --plugin-dirs --interface -4 --ipv4 -6 --ipv6 -p --player -a --player-args --player-env -v --player-verbose --verbose-player -n --player-fifo --fifo --player-http --player-continuous-http --player-external-http --player-external-http-continuous --player-external-http-interface --player-external-http-port --player-passthrough --player-no-close -t --title -O --stdout -o --output -r --record -R --record-and-pipe --fs-safe-rules -f --force --skip --progress --url --default-stream --stream-url --retry-streams --retry-max --retry-open --stream-types --stream-priority --stream-sorting-excludes --ringbuffer-size --stream-segment-attempts --stream-segment-threads --stream-segment-timeout --stream-segmented-duration --stream-segmented-queue-deadline --stream-timeout --stream-passthrough-encrypted --mux-subtitles --hls-live-edge --hls-segment-stream-data --hls-playlist-reload-attempts --hls-playlist-reload-time --hls-segment-queue-threshold --hls-segment-ignore-names --hls-segment-key-uri --hls-audio-select --hls-start-offset --hls-duration --hls-live-restart --dash-manifest-reload-attempts --ffmpeg-ffmpeg --ffmpeg-no-validation --ffmpeg-verbose --ffmpeg-verbose-path --ffmpeg-loglevel --ffmpeg-fout --ffmpeg-video-transcode --ffmpeg-audio-transcode --ffmpeg-copyts --ffmpeg-start-at-zero --ffmpeg-validation-timeout --http-proxy --http-cookie --http-cookies-file --http-header --http-query-param --http-ignore-env --http-no-ssl-verify --http-disable-dh --http-ssl-cert --http-ssl-cert-crt-key --http-timeout --webbrowser --webbrowser-executable --webbrowser-timeout --webbrowser-cdp-host --webbrowser-cdp-port --webbrowser-cdp-timeout --webbrowser-headless --bbciplayer-username --bbciplayer-password --bbciplayer-hd --clubbingtv-username --clubbingtv-password --kick-low-latency --niconico-email --niconico-password --niconico-user-session --niconico-purge-credentials --niconico-timeshift-offset --openrectv-email --openrectv-password --pixiv-sessionid --pixiv-devicetoken --pixiv-purge-credentials --pixiv-performer --raiplay-email --raiplay-password --raiplay-purge-credentials --soop-username --soop-password --soop-purge-credentials --soop-stream-password --steam-email --steam-password --streann-url --tf1-email --tf1-password --tf1-purge-credentials --twitcasting-password --twitch-low-latency --twitch-supported-codecs --twitch-api-header --twitch-access-token-param --twitch-force-client-integrity --twitch-purge-client-integrity --ustream-password --ustvnow-username --ustvnow-password --wwenetwork-email --wwenetwork-password --yupptv-boxid --yupptv-yuppflixtoken --yupptv-purge-credentials --zattoo-email --zattoo-password --zattoo-purge-credentials --zattoo-stream-types)



_shtab_streamlink__l_choices=(none critical error warning info debug trace all)
_shtab_streamlink___loglevel_choices=(none critical error warning info debug trace all)
_shtab_streamlink___fs_safe_rules_choices=(POSIX Windows)
_shtab_streamlink___progress_choices=(yes force no)

_shtab_streamlink__h_nargs=0
_shtab_streamlink___help_nargs=0
_shtab_streamlink__V_nargs=0
_shtab_streamlink___version_nargs=0
_shtab_streamlink___version_check_nargs=0
_shtab_streamlink___no_config_nargs=0
_shtab_streamlink__Q_nargs=0
_shtab_streamlink___quiet_nargs=0
_shtab_streamlink__j_nargs=0
_shtab_streamlink___json_nargs=0
_shtab_streamlink___plugins_nargs=0
_shtab_streamlink___no_plugin_cache_nargs=0
_shtab_streamlink___no_plugin_sideloading_nargs=0
_shtab_streamlink__4_nargs=0
_shtab_streamlink___ipv4_nargs=0
_shtab_streamlink__6_nargs=0
_shtab_streamlink___ipv6_nargs=0
_shtab_streamlink__v_nargs=0
_shtab_streamlink___player_verbose_nargs=0
_shtab_streamlink___verbose_player_nargs=0
_shtab_streamlink__n_nargs=0
_shtab_streamlink___player_fifo_nargs=0
_shtab_streamlink___fifo_nargs=0
_shtab_streamlink___player_http_nargs=0
_shtab_streamlink___player_continuous_http_nargs=0
_shtab_streamlink___player_external_http_nargs=0
_shtab_streamlink___player_no_close_nargs=0
_shtab_streamlink__O_nargs=0
_shtab_streamlink___stdout_nargs=0
_shtab_streamlink__f_nargs=0
_shtab_streamlink___force_nargs=0
_shtab_streamlink___skip_nargs=0
_shtab_streamlink___stream_url_nargs=0
_shtab_streamlink___stream_passthrough_encrypted_nargs=0
_shtab_streamlink___mux_subtitles_nargs=0
_shtab_streamlink___hls_segment_stream_data_nargs=0
_shtab_streamlink___hls_live_restart_nargs=0
_shtab_streamlink___ffmpeg_no_validation_nargs=0
_shtab_streamlink___ffmpeg_verbose_nargs=0
_shtab_streamlink___ffmpeg_copyts_nargs=0
_shtab_streamlink___ffmpeg_start_at_zero_nargs=0
_shtab_streamlink___http_ignore_env_nargs=0
_shtab_streamlink___http_no_ssl_verify_nargs=0
_shtab_streamlink___http_disable_dh_nargs=0
_shtab_streamlink___http_ssl_cert_crt_key_nargs=2
_shtab_streamlink___bbciplayer_hd_nargs=0
_shtab_streamlink___kick_low_latency_nargs=0
_shtab_streamlink___niconico_purge_credentials_nargs=0
_shtab_streamlink___pixiv_purge_credentials_nargs=0
_shtab_streamlink___raiplay_purge_credentials_nargs=0
_shtab_streamlink___soop_purge_credentials_nargs=0
_shtab_streamlink___afreeca_purge_credentials_nargs=0
_shtab_streamlink___tf1_purge_credentials_nargs=0
_shtab_streamlink___twitch_disable_ads_nargs=0
_shtab_streamlink___twitch_disable_hosting_nargs=0
_shtab_streamlink___twitch_disable_reruns_nargs=0
_shtab_streamlink___twitch_low_latency_nargs=0
_shtab_streamlink___twitch_force_client_integrity_nargs=0
_shtab_streamlink___twitch_purge_client_integrity_nargs=0
_shtab_streamlink___yupptv_purge_credentials_nargs=0
_shtab_streamlink___zattoo_purge_credentials_nargs=0


# $1=COMP_WORDS[1]
_shtab_compgen_files() {
  compgen -f -- $1  # files
}

# $1=COMP_WORDS[1]
_shtab_compgen_dirs() {
  compgen -d -- $1  # recurse into subdirs
}

# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
  echo "${1//[^[:word:]]/_}"
}

# set default values (called for the initial parser & any subparsers)
_set_parser_defaults() {
  local subparsers_var="${prefix}_subparsers[@]"
  sub_parsers=${!subparsers_var-}

  local current_option_strings_var="${prefix}_option_strings[@]"
  current_option_strings=${!current_option_strings_var}

  completed_positional_actions=0

  _set_new_action "pos_${completed_positional_actions}" true
}

# $1=action identifier
# $2=positional action (bool)
# set all identifiers for an action's parameters
_set_new_action() {
  current_action="${prefix}_$(_shtab_replace_nonword $1)"

  local current_action_compgen_var=${current_action}_COMPGEN
  current_action_compgen="${!current_action_compgen_var-}"

  local current_action_choices_var="${current_action}_choices[@]"
  current_action_choices="${!current_action_choices_var-}"

  local current_action_nargs_var="${current_action}_nargs"
  if [ -n "${!current_action_nargs_var-}" ]; then
    current_action_nargs="${!current_action_nargs_var}"
  else
    current_action_nargs=1
  fi

  current_action_args_start_index=$(( $word_index + 1 - $pos_only ))

  current_action_is_positional=$2
}

# Notes:
# `COMPREPLY`: what will be rendered after completion is triggered
# `completing_word`: currently typed word to generate completions for
# `${!var}`: evaluates the content of `var` and expand its content as a variable
#     hello="world"
#     x="hello"
#     ${!x} -> ${hello} -> "world"
_shtab_streamlink() {
  local completing_word="${COMP_WORDS[COMP_CWORD]}"
  local previous_word="${COMP_WORDS[COMP_CWORD-1]}"
  local completed_positional_actions
  local current_action
  local current_action_args_start_index
  local current_action_choices
  local current_action_compgen
  local current_action_is_positional
  local current_action_nargs
  local current_option_strings
  local sub_parsers
  COMPREPLY=()

  local prefix=_shtab_streamlink
  local word_index=0
  local pos_only=0 # "--" delimiter not encountered yet
  _set_parser_defaults
  word_index=1

  # determine what arguments are appropriate for the current state
  # of the arg parser
  while [ $word_index -ne $COMP_CWORD ]; do
    local this_word="${COMP_WORDS[$word_index]}"

    if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then
      if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then
        # valid subcommand: add it to the prefix & reset the current action
        prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
        _set_parser_defaults
      fi

      if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then
        # a new action should be acquired (due to recognised option string or
        # no more input expected from current action);
        # the next positional action can fill in here
        _set_new_action $this_word false
      fi

      if [[ "$current_action_nargs" != "*" ]] && \
         [[ "$current_action_nargs" != "+" ]] && \
         [[ "$current_action_nargs" != "?" ]] && \
         [[ "$current_action_nargs" != *"..." ]] && \
         (( $word_index + 1 - $current_action_args_start_index - $pos_only >= \
            $current_action_nargs )); then
        $current_action_is_positional && let "completed_positional_actions += 1"
        _set_new_action "pos_${completed_positional_actions}" true
      fi
    else
      pos_only=1 # "--" delimiter encountered
    fi

    let "word_index+=1"
  done

  # Generate the completions

  if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
    # optional argument started: use option strings
    mapfile -t COMPREPLY < <(compgen -W "${current_option_strings[*]}" -- "${completing_word}")
  elif [[ "${previous_word}" == ">" || "${previous_word}" == ">>" ||
          "${previous_word}" =~ ^[12]">" || "${previous_word}" =~ ^[12]">>" ]]; then
    # handle redirection operators
    mapfile -t COMPREPLY < <(compgen -f -- "${completing_word}")
  else
    # use choices & compgen
    [ -n "${current_action_compgen}" ] &&
      mapfile -t COMPREPLY < <("${current_action_compgen}" "${completing_word}")
    mapfile -t -O "${#COMPREPLY[@]}" COMPREPLY < <(
      compgen -W "${current_action_choices[*]}" -- "${completing_word}")
  fi

  return 0
}

complete -o filenames -F _shtab_streamlink streamlink