#compdef streamlink

# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab
# Usage:
# 1) Copy this to a file named _streamlink (e.g. ~/.local/share/zsh_completion/_streamlink).
# 2) Add the following line to your .zshrc:
#    fpath=(~/.local/share/zsh_completion $fpath)
# See also: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org


_shtab_streamlink_commands() {
  local _commands=(
    
  )
  _describe 'streamlink commands' _commands
}

_shtab_streamlink_options=(
  {-h,--help}"[Show this help message and exit.]"
  "(- : *)"{-V,--version}"[Show version string and exit.]"
  "--version-check[Run a version check and exit.]"
  "--auto-version-check[Enable or disable the automatic check for a new version of Streamlink.]:{yes,true,1,on,no,false,0,off}:"
  "*--config[Load options from this config file.]:FILENAME:"
  "--no-config[Disable loading any default or custom config files.]"
  "--locale[Override the system\'s locale setting, for selecting the preferred subtitle and audio language.]:LOCALE:"
  {-l,--loglevel}"[Set the log message threshold.]:LEVEL:(none critical error warning info debug trace all)"
  "--logformat[Set a custom logging format.]:FORMAT:"
  "--logdateformat[Set a custom logging date format.]:DATEFORMAT:"
  "--logfile[Append log output to \`FILE\` instead of writing to stdout\/stderr.]:FILE:"
  {-Q,--quiet}"[Suppress all console and log output, and also disable user prompts.]"
  {-j,--json}"[Output JSON representations instead of the normal text output.]"
  "--plugins[Print a list of all currently installed plugins.]"
  "--show-matchers[Show the list of matchers of a specific plugin (URL regex pattern with opt. priority and opt. name).]:PLUGIN:"
  "--can-handle-url[Check if Streamlink has a plugin that can handle the specified URL.]:URL:"
  "--can-handle-url-no-redirect[Same as --can-handle-url, but without following redirects when looking up the URL.]:URL:"
  "--no-plugin-cache[Disable I\/O of the plugin key-value store.]"
  "--no-plugin-sideloading[Disable automatic sideloading of third-party plugins from the default location.]"
  "*--plugin-dir[Load additional plugins from this directory.]:DIRECTORY:"
  "*--plugin-dirs[Load additional plugins from a list of comma-separated directories. (deprecated)]:DIRECTORY:"
  "--interface[Select the network interface, either by IP address or by interface name.]:INTERFACE:"
  {-4,--ipv4}"[Resolve address names to IPv4 only. This option overrides --ipv6.]"
  {-6,--ipv6}"[Resolve address names to IPv6 only. This option overrides --ipv4.]"
  {-p,--player}"[Set the player executable that will be launched (unless a different output method was chosen).]:PATH:"
  {-a,--player-args}"[Set a string of custom --player launch arguments that will be parsed and tokenized.]:ARGUMENTS:"
  "*--player-env[Add an additional environment variable to the spawned --player process, in addition to the ones inherited from]:KEY=VALUE:"
  {-v,--player-verbose}"[Write the --player\'s stdout\/stderr output to Streamlink\'s stdout\/stderr output.]"
  "--verbose-player[Deprecated in favor of --player-verbose.]"
  {-n,--player-fifo}"[Make the --player read the stream through a named pipe instead of the stdin pipe.]"
  "--fifo[Deprecated in favor of --player-fifo.]"
  "--player-http[Make the --player read the stream through HTTP instead of the stdin pipe.]"
  "--player-continuous-http[Make the --player read the stream through HTTP, but unlike --player-http,]"
  "--player-external-http[Serve stream data through HTTP without opening the --player. This is]"
  "--player-external-http-continuous[Set the run-mode of --player-external-http to continuous or non-continuous.]:{yes,true,1,on,no,false,0,off}:"
  "--player-external-http-interface[Set the network interface on which the HTTP server will be listening on.]:INTERFACE:"
  "--player-external-http-port[Set the port of the external HTTP server if that mode is enabled.]:PORT:"
  "--player-passthrough[A comma-delimited list of stream types to pass to the --player as a URL to]:TYPES:"
  "--player-no-close[By default, Streamlink will close the --player when the stream ends.]"
  {-t,--title}"[Change the title of the --player\'s window.]:TITLE:"
  {-O,--stdout}"[Write stream data to \`stdout\` instead of playing it in the --player.]"
  {-o,--output}"[Write stream data to \`FILENAME\` instead of playing it in the --player.]:FILENAME:"
  {-r,--record}"[Write stream data to \`FILENAME\` while at the same time allowing playback in the --player or writing it to --stdout.]:FILENAME:"
  {-R,--record-and-pipe}"[Deprecated in favor of --stdout --record\=FILENAME.]:FILENAME:"
  "--fs-safe-rules[The rules used to make formatting variables filesystem-safe are chosen]:{POSIX,Windows}:(POSIX Windows)"
  {-f,--force}"[When using --output or --record, always write to file even if it already exists (overwrite).]"
  "--skip[When using --output or --record, never write to file if it already exists (don\'t prompt).]"
  "--progress[When using --output or --record, show or hide the download progress bar, or force it if there\'s no terminal.]:{yes,force,no}:(yes force no)"
  "--url[A URL to attempt to extract streams from.]:URL:"
  "--default-stream[Stream to play.]:STREAM:"
  "--stream-url[If possible, translate the resolved stream to a URL and print it.]"
  "--retry-streams[Retry fetching the list of available streams until streams are found]:DELAY:"
  "--retry-max[Stop fetching the list of available streams after \`COUNT\` retry attempt(s).]:COUNT:"
  "--retry-open[After a successful fetch, try \`ATTEMPTS\` time(s) to open the stream until giving up.]:ATTEMPTS:"
  {--stream-types,--stream-priority}"[A comma-delimited list of stream types to allow.]:TYPES:"
  "--stream-sorting-excludes[Fine-tune the \`best\` and \`worst\` stream name synonyms by excluding unwanted streams.]:STREAMS:"
  "--ringbuffer-size[The maximum size of the ringbuffer.]:SIZE:"
  "--stream-segment-attempts[The number of download attempts of each stream segment before giving up.]:ATTEMPTS:"
  "--stream-segment-threads[The size of the thread pool used to download segments. Minimum value is \`1\` and maximum is \`10\`.]:THREADS:"
  "--stream-segment-timeout[The maximum time to wait for each segment to start downloading.]:TIMEOUT:"
  "--stream-segmented-duration[Limit the output duration of segmented streams, like HLS and DASH.]:[[XX:]XX:]XX[.XX] | [XXh][XXm][XX[.XX]s]:"
  "--stream-segmented-queue-deadline[A multiplication factor of the time frame in which new segments must be queued in order to prevent playback issues]:FACTOR:"
  "--stream-timeout[The maximum time to wait for an unfiltered stream to continue outputting data.]:TIMEOUT:"
  "--stream-passthrough-encrypted[Pass through data from encrypted streams without decryption or encryption checks.]"
  "--mux-subtitles[Automatically mux available subtitles into the output stream.]"
  "--hls-live-edge[Number of segments from the live stream\'s current live position to begin streaming.]:SEGMENTS:"
  "--hls-segment-stream-data[Immediately write segment data into output buffer while downloading.]"
  "--hls-playlist-reload-attempts[The maximum number of attempts when reloading the HLS playlist before giving up.]:ATTEMPTS:"
  "--hls-playlist-reload-time[Set a custom HLS playlist reload time value, either in seconds or by using one of the following keywords\:]:TIME:"
  "--hls-segment-queue-threshold[Deprecated in favor of --stream-segmented-queue-deadline.]:FACTOR:"
  "--hls-segment-ignore-names[A comma-delimited list of segment names that will get filtered out.]:NAMES:"
  "--hls-segment-key-uri[Override the segment encryption key URIs for encrypted streams.]:URI:"
  "--hls-audio-select[Select one or more specific audio sources by language code or name.]:CODE:"
  "--hls-start-offset[The amount of time to skip from the beginning of the stream.]:[[XX:]XX:]XX[.XX] | [XXh][XXm][XX[.XX]s]:"
  "--hls-duration[Deprecated in favor of --stream-segmented-duration.]:[[XX:]XX:]XX[.XX] | [XXh][XXm][XX[.XX]s]:"
  "--hls-live-restart[Skip to the beginning of a live stream, or as far back as possible.]"
  "--dash-manifest-reload-attempts[The maximum number of attempts when reloading the DASH manifest before giving up.]:ATTEMPTS:"
  "--ffmpeg-ffmpeg[Set the location of the FFmpeg executable if it can\'t be resolved]:FILENAME:"
  "--ffmpeg-no-validation[Disable FFmpeg validation and version logging.]"
  "--ffmpeg-verbose[Write FFmpeg\'s stderr output to Streamlink\'s stderr output.]"
  "--ffmpeg-verbose-path[Write FFmpeg\'s stderr output to PATH.]:PATH:"
  "--ffmpeg-loglevel[Change FFmpeg\'s \`-loglevel\` value to \`LOGLEVEL\`.]:LOGLEVEL:"
  "--ffmpeg-fout[Set the output format to \`OUTFORMAT\`. This only applies to streams which require muxing.]:OUTFORMAT:"
  "--ffmpeg-video-transcode[Transcode the video to \`CODEC\`. This only applies to streams which require muxing.]:CODEC:"
  "--ffmpeg-audio-transcode[Transcode the audio to \`CODEC\`. This only applies to streams which require muxing.]:CODEC:"
  "--ffmpeg-copyts[Set the \`-copyts\` FFmpeg option, so input timestamps won\'t be processed]"
  "--ffmpeg-start-at-zero[Enable the \`-start_at_zero\` FFmpeg option when using --ffmpeg-copyts.]"
  "--ffmpeg-validation-timeout[Timeout in seconds for FFmpeg version validation.]:SECONDS:"
  "--http-proxy[An HTTP proxy to use for all HTTP and HTTPS requests, including WebSocket connections.]:HTTP_PROXY:"
  "*--http-cookie[A cookie to add to each HTTP request.]:KEY=VALUE:"
  "*--http-cookies-file[A path to a cookies file whose cookie data will be added to HTTP requests.]:PATH:"
  "*--http-header[A header to add to each HTTP request.]:KEY=VALUE:"
  "*--http-query-param[A query parameter to add to each HTTP request.]:KEY=VALUE:"
  "--http-ignore-env[Ignore HTTP settings set in the environment, such as environment variables (\`HTTP_PROXY\`, etc)]"
  "--http-no-ssl-verify[Don\'t attempt to verify TLS\/SSL certificates.]"
  "--http-disable-dh[Disable Diffie Hellman key exchange.]"
  "--http-ssl-cert[SSL certificate to use\: a .pem file.]:PEM_FILENAME:"
  "--http-ssl-cert-crt-key[SSL certificate to use\: a .crt and a .key file.]:('CRT_FILENAME', 'KEY_FILENAME'):"
  "--http-timeout[Set the general timeout value used by all HTTP requests except the ones covered by other options.]:TIMEOUT:"
  "--webbrowser[Enable or disable support for Streamlink\'s webbrowser API.]:{yes,true,1,on,no,false,0,off}:"
  "--webbrowser-executable[Path to the web browser\'s executable.]:PATH:"
  "--webbrowser-timeout[The maximum amount of time which the web browser can take to launch and execute.]:TIME:"
  "--webbrowser-cdp-host[Host for the web browser\'s inter-process communication interface (CDP specific).]:HOST:"
  "--webbrowser-cdp-port[Port for the web browser\'s inter-process communication interface (CDP specific).]:PORT:"
  "--webbrowser-cdp-timeout[The maximum amount of time for waiting on a single CDP command response.]:TIME:"
  "--webbrowser-headless[Whether to launch the web browser in headless mode or not.]:{yes,true,1,on,no,false,0,off}:"
  "--bbciplayer-username[The username used to register with bbc.co.uk.]:USERNAME:"
  "--bbciplayer-password[A bbc.co.uk account password to use with --bbciplayer-username.]:PASSWORD:"
  "--bbciplayer-hd[Prefer HD streams over local SD streams, some live programmes may not be broadcast in HD.]"
  "--clubbingtv-username[The username used to register with Clubbing TV.]:clubbingtv_username:"
  "--clubbingtv-password[A Clubbing TV account password to use with --clubbingtv-username.]:clubbingtv_password:"
  "--kick-low-latency[Enables low latency streaming by prefetching HLS segments.]"
  "--niconico-email[The email or phone number associated with your Niconico account]:EMAIL:"
  "--niconico-password[The password of your Niconico account]:PASSWORD:"
  "--niconico-user-session[Value of the user-session token.]:VALUE:"
  "--niconico-purge-credentials[Purge cached Niconico credentials to initiate a new session and reauthenticate.]"
  "--niconico-timeshift-offset[Amount of time to skip from the beginning of a stream.]:[[XX:]XX:]XX | [XXh][XXm][XXs]:"
  "--openrectv-email[The email associated with your openrectv account, required to access any openrectv stream.]:EMAIL:"
  "--openrectv-password[An openrectv account password to use with --openrectv-email.]:PASSWORD:"
  "--pixiv-sessionid[The pixiv.net sessionid that\'s used in pixiv\'s PHPSESSID cookie.]:SESSIONID:"
  "--pixiv-devicetoken[The pixiv.net device token that\'s used in pixiv\'s device_token cookie.]:DEVICETOKEN:"
  "--pixiv-purge-credentials[Purge cached Pixiv credentials to initiate a new session and reauthenticate.]"
  "--pixiv-performer[Select a co-host stream instead of the owner stream.]:USER:"
  "--raiplay-email[The email used to register with raiplay.it.]:EMAIL:"
  "--raiplay-password[A raiplay.it account password to use with --raiplay-email.]:PASSWORD:"
  "--raiplay-purge-credentials[Purge cached RaiPlay credentials to initiate a new session and reauthenticate.]"
  "--soop-username[The username used to register with sooplive.com.]:USERNAME:"
  "--soop-password[A sooplive.com account password to use with --soop-username.]:PASSWORD:"
  "--soop-purge-credentials[Purge cached Soop credentials to initiate a new session and reauthenticate.]"
  "--soop-stream-password[The password for the stream.]:STREAM_PASSWORD:"
  "--steam-email[A Steam account email address to access friends\/private streams]:EMAIL:"
  "--steam-password[A Steam account password to use with --steam-email.]:PASSWORD:"
  "--streann-url[Source URL where the iframe is located, only required for direct URLs of ott.streann.com]:URL:"
  "--tf1-email[The email address used to register with tf1.fr.]:EMAIL:"
  "--tf1-password[A tf1.fr account password to use with --tf1-email.]:PASSWORD:"
  "--tf1-purge-credentials[Purge cached tf1.fr credentials to initiate a new session and reauthenticate.]"
  "--twitcasting-password[Password for private Twitcasting streams.]:PASSWORD:"
  "--twitch-low-latency[Enables low latency streaming by prefetching HLS segments.]"
  "--twitch-supported-codecs[A comma-separated list of codec names which signals Twitch the client\'s stream codec preference.]:CODECS:"
  "*--twitch-api-header[A header to add to each Twitch API HTTP request.]:KEY=VALUE:"
  "*--twitch-access-token-param[A parameter to add to the API request for acquiring the streaming access token.]:KEY=VALUE:"
  "--twitch-force-client-integrity[Don\'t attempt requesting the streaming access token without a client-integrity token.]"
  "--twitch-purge-client-integrity[Purge cached Twitch client-integrity token and acquire a new one.]"
  "--ustream-password[A password to access password protected UStream.tv channels.]:PASSWORD:"
  "--ustvnow-username[Your USTV Now account username]:USERNAME:"
  "--ustvnow-password[Your USTV Now account password]:PASSWORD:"
  "--wwenetwork-email[The email associated with your WWE Network account, required to access any WWE Network stream.]:EMAIL:"
  "--wwenetwork-password[A WWE Network account password to use with --wwenetwork-email.]:PASSWORD:"
  "--yupptv-boxid[The yupptv.com boxid that\'s used in the BoxId cookie.]:BOXID:"
  "--yupptv-yuppflixtoken[The yupptv.com yuppflixtoken that\'s used in the YuppflixToken cookie.]:YUPPFLIXTOKEN:"
  "--yupptv-purge-credentials[Purge cached YuppTV credentials to initiate a new session and reauthenticate.]"
  "--zattoo-email[The email associated with your zattoo account, required to access any zattoo stream.]:EMAIL:"
  "--zattoo-password[A zattoo account password to use with --zattoo-email.]:PASSWORD:"
  "--zattoo-purge-credentials[Purge cached zattoo credentials to initiate a new session and reauthenticate.]"
  "--zattoo-stream-types[A comma-delimited list of stream types which should be used.]:TYPES:"
  ":A URL to attempt to extract streams from.:"
  ":Stream to play.:"
)

# guard to ensure default positional specs are added only once per session
_shtab_streamlink_defaults_added=0


_shtab_streamlink() {
  local context state line curcontext="$curcontext" one_or_more='(*)' remainder='(-)*:' default='*::: :->streamlink'

  # Add default positional/remainder specs only if none exist, and only once per session
  if (( ! _shtab_streamlink_defaults_added )); then
    if (( ${_shtab_streamlink_options[(I)${(q)one_or_more}*]} +          ${_shtab_streamlink_options[(I)${(q)remainder}*]} +          ${_shtab_streamlink_options[(I)${(q)default}]} == 0 )); then
      _shtab_streamlink_options+=(': :_shtab_streamlink_commands' '*::: :->streamlink')
    fi
    _shtab_streamlink_defaults_added=1
  fi
  _arguments -C -s $_shtab_streamlink_options

  case $state in
    streamlink)
      words=($line[1] "${words[@]}")
      (( CURRENT += 1 ))
      curcontext="${curcontext%:*:*}:_shtab_streamlink-$line[1]:"
      case $line[1] in
        
      esac
  esac
}



typeset -A opt_args

if [[ $zsh_eval_context[-1] == eval ]]; then
  # eval/source/. command, register function for later
  compdef _shtab_streamlink -N streamlink
else
  # autoload from fpath, call function directly
  _shtab_streamlink "$@"
fi
