#!/usr/bin/env bash
#
# sslteam Bash Completion
# =======================
#
# Bash completion support for the `sslteam` command,
# generated by [picocli](https://picocli.info/) version 4.7.7.
#
# Installation
# ------------
#
# 1. Source all completion scripts in your .bash_profile
#
#   cd $YOUR_APP_HOME/bin
#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
#
# 2. Open a new bash console, and type `sslteam [TAB][TAB]`
#
# 1a. Alternatively, if you have [bash-completion](https://github.com/scop/bash-completion) installed:
#     Place this file in a `bash-completion.d` folder:
#
#   * /etc/bash-completion.d
#   * /usr/local/etc/bash-completion.d
#   * ~/bash-completion.d
#
# Documentation
# -------------
# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
# 'sslteam (..)'. By reading entered command line parameters,
# it determines possible bash completions and writes them to the COMPREPLY variable.
# Bash then completes the user input if only one entry is listed in the variable or
# shows the options if more than one is listed in COMPREPLY.
#
# References
# ----------
# [1] http://stackoverflow.com/a/12495480/1440785
# [2] http://tiswww.case.edu/php/chet/bash/FAQ
# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
# [4] http://zsh.sourceforge.net/Doc/Release/Options.html#index-COMPLETE_005fALIASES
# [5] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
# [6] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
# [7] https://stackoverflow.com/questions/3249432/can-a-bash-tab-completion-script-be-used-in-zsh/27853970#27853970
#

if [ -n "$BASH_VERSION" ]; then
  # Enable programmable completion facilities when using bash (see [3])
  shopt -s progcomp
elif [ -n "$ZSH_VERSION" ]; then
  # Make alias a distinct command for completion purposes when using zsh (see [4])
  setopt COMPLETE_ALIASES
  alias compopt=complete

  # Enable bash completion in zsh (see [7])
  # Only initialize completions module once to avoid unregistering existing completions.
  if ! type compdef > /dev/null; then
    autoload -U +X compinit && compinit
  fi
  autoload -U +X bashcompinit && bashcompinit
fi

# CompWordsContainsArray takes an array and then checks
# if all elements of this array are in the global COMP_WORDS array.
#
# Returns zero (no error) if all elements of the array are in the COMP_WORDS array,
# otherwise returns 1 (error).
function CompWordsContainsArray() {
  declare -a localArray
  localArray=("$@")
  local findme
  for findme in "${localArray[@]}"; do
    if ElementNotInCompWords "$findme"; then return 1; fi
  done
  return 0
}
function ElementNotInCompWords() {
  local findme="$1"
  local element
  for element in "${COMP_WORDS[@]}"; do
    if [[ "$findme" = "$element" ]]; then return 1; fi
  done
  return 0
}

# The `currentPositionalIndex` function calculates the index of the current positional parameter.
#
# currentPositionalIndex takes three parameters:
# the command name,
# a space-separated string with the names of options that take a parameter, and
# a space-separated string with the names of boolean options (that don't take any params).
# When done, this function echos the current positional index to std_out.
#
# Example usage:
# local currIndex=$(currentPositionalIndex "mysubcommand" "$ARG_OPTS" "$FLAG_OPTS")
function currentPositionalIndex() {
  local commandName="$1"
  local optionsWithArgs="$2"
  local booleanOptions="$3"
  local previousWord
  local result=0

  for i in $(seq $((COMP_CWORD - 1)) -1 0); do
    previousWord=${COMP_WORDS[i]}
    if [ "${previousWord}" = "$commandName" ]; then
      break
    fi
    if [[ "${optionsWithArgs}" =~ ${previousWord} ]]; then
      ((result-=2)) # Arg option and its value not counted as positional param
    elif [[ "${booleanOptions}" =~ ${previousWord} ]]; then
      ((result-=1)) # Flag option itself not counted as positional param
    fi
    ((result++))
  done
  echo "$result"
}

# compReplyArray generates a list of completion suggestions based on an array, ensuring all values are properly escaped.
#
# compReplyArray takes a single parameter: the array of options to be displayed
#
# The output is echoed to std_out, one option per line.
#
# Example usage:
# local options=("foo", "bar", "baz")
# local IFS=$'\n'
# COMPREPLY=($(compReplyArray "${options[@]}"))
function compReplyArray() {
  declare -a options
  options=("$@")
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local i
  local quoted
  local optionList=()

  for (( i=0; i<${#options[@]}; i++ )); do
    # Double escape, since we want escaped values, but compgen -W expands the argument
    printf -v quoted %q "${options[i]}"
    quoted=\'${quoted//\'/\'\\\'\'}\'

    optionList[i]=$quoted
  done

  # We also have to add another round of escaping to $curr_word.
  curr_word=${curr_word//\\/\\\\}
  curr_word=${curr_word//\'/\\\'}

  # Actually generate completions.
  local IFS=$'\n'
  echo -e "$(compgen -W "${optionList[*]}" -- "$curr_word")"
}

# Bash completion entry point function.
# _complete_sslteam finds which commands and subcommands have been specified
# on the command line and delegates to the appropriate function
# to generate possible options and subcommands for the last specified subcommand.
function _complete_sslteam() {
  # Edge case: if command line has no space after subcommand, then don't assume this subcommand is selected (remkop/picocli#1468).
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} auth" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ping" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} version" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} config" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} completion" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert" ];    then _picocli_sslteam; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} auth device" ];    then _picocli_sslteam_auth; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} auth password" ];    then _picocli_sslteam_auth; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} auth logout" ];    then _picocli_sslteam_auth; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} auth logout-all" ];    then _picocli_sslteam_auth; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} config set" ];    then _picocli_sslteam_config; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} config show" ];    then _picocli_sslteam_config; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls tofu" ];    then _picocli_sslteam_tls; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls trust-store" ];    then _picocli_sslteam_tls; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls show" ];    then _picocli_sslteam_tls; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls replace" ];    then _picocli_sslteam_tls; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} tls forget" ];    then _picocli_sslteam_tls; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca status" ];    then _picocli_sslteam_ca; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root" ];    then _picocli_sslteam_ca; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate" ];    then _picocli_sslteam_ca; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca trust" ];    then _picocli_sslteam_ca; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root list" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root create" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root import" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root show" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root remove" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root setup" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root download" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root retire" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root revoke" ];    then _picocli_sslteam_ca_root; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca root download certificate" ];    then _picocli_sslteam_ca_root_download; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate status" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate download" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate create" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate setup" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate sign" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate activate" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate retire" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate revoke" ];    then _picocli_sslteam_ca_intermediate; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate download certificate" ];    then _picocli_sslteam_ca_intermediate_download; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca intermediate download chain" ];    then _picocli_sslteam_ca_intermediate_download; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca trust install" ];    then _picocli_sslteam_ca_trust; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca trust verify" ];    then _picocli_sslteam_ca_trust; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca trust remove" ];    then _picocli_sslteam_ca_trust; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} ca trust list" ];    then _picocli_sslteam_ca_trust; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert generate" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert inspect" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert list" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert show" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert download" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert artifact" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert revoke" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert revocations" ];    then _picocli_sslteam_cert; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert download certificate" ];    then _picocli_sslteam_cert_download; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} cert download chain" ];    then _picocli_sslteam_cert_download; return $?; fi

  # Find the longest sequence of subcommands and call the bash function for that subcommand.
  local cmds0=(auth)
  local cmds1=(ping)
  local cmds2=(version)
  local cmds3=(config)
  local cmds4=(completion)
  local cmds5=(tls)
  local cmds6=(ca)
  local cmds7=(cert)
  local cmds8=(auth device)
  local cmds9=(auth password)
  local cmds10=(auth logout)
  local cmds11=(auth logout-all)
  local cmds12=(config set)
  local cmds13=(config show)
  local cmds14=(tls tofu)
  local cmds15=(tls trust-store)
  local cmds16=(tls show)
  local cmds17=(tls replace)
  local cmds18=(tls forget)
  local cmds19=(ca status)
  local cmds20=(ca root)
  local cmds21=(ca intermediate)
  local cmds22=(ca trust)
  local cmds23=(ca root list)
  local cmds24=(ca root create)
  local cmds25=(ca root import)
  local cmds26=(ca root show)
  local cmds27=(ca root remove)
  local cmds28=(ca root setup)
  local cmds29=(ca root download)
  local cmds30=(ca root retire)
  local cmds31=(ca root revoke)
  local cmds32=(ca root download certificate)
  local cmds33=(ca intermediate status)
  local cmds34=(ca intermediate download)
  local cmds35=(ca intermediate create)
  local cmds36=(ca intermediate setup)
  local cmds37=(ca intermediate sign)
  local cmds38=(ca intermediate activate)
  local cmds39=(ca intermediate retire)
  local cmds40=(ca intermediate revoke)
  local cmds41=(ca intermediate download certificate)
  local cmds42=(ca intermediate download chain)
  local cmds43=(ca trust install)
  local cmds44=(ca trust verify)
  local cmds45=(ca trust remove)
  local cmds46=(ca trust list)
  local cmds47=(cert generate)
  local cmds48=(cert inspect)
  local cmds49=(cert list)
  local cmds50=(cert show)
  local cmds51=(cert download)
  local cmds52=(cert artifact)
  local cmds53=(cert revoke)
  local cmds54=(cert revocations)
  local cmds55=(cert download certificate)
  local cmds56=(cert download chain)

  if CompWordsContainsArray "${cmds56[@]}"; then _picocli_sslteam_cert_download_chain; return $?; fi
  if CompWordsContainsArray "${cmds55[@]}"; then _picocli_sslteam_cert_download_certificate; return $?; fi
  if CompWordsContainsArray "${cmds54[@]}"; then _picocli_sslteam_cert_revocations; return $?; fi
  if CompWordsContainsArray "${cmds53[@]}"; then _picocli_sslteam_cert_revoke; return $?; fi
  if CompWordsContainsArray "${cmds52[@]}"; then _picocli_sslteam_cert_artifact; return $?; fi
  if CompWordsContainsArray "${cmds51[@]}"; then _picocli_sslteam_cert_download; return $?; fi
  if CompWordsContainsArray "${cmds50[@]}"; then _picocli_sslteam_cert_show; return $?; fi
  if CompWordsContainsArray "${cmds49[@]}"; then _picocli_sslteam_cert_list; return $?; fi
  if CompWordsContainsArray "${cmds48[@]}"; then _picocli_sslteam_cert_inspect; return $?; fi
  if CompWordsContainsArray "${cmds47[@]}"; then _picocli_sslteam_cert_generate; return $?; fi
  if CompWordsContainsArray "${cmds46[@]}"; then _picocli_sslteam_ca_trust_list; return $?; fi
  if CompWordsContainsArray "${cmds45[@]}"; then _picocli_sslteam_ca_trust_remove; return $?; fi
  if CompWordsContainsArray "${cmds44[@]}"; then _picocli_sslteam_ca_trust_verify; return $?; fi
  if CompWordsContainsArray "${cmds43[@]}"; then _picocli_sslteam_ca_trust_install; return $?; fi
  if CompWordsContainsArray "${cmds42[@]}"; then _picocli_sslteam_ca_intermediate_download_chain; return $?; fi
  if CompWordsContainsArray "${cmds41[@]}"; then _picocli_sslteam_ca_intermediate_download_certificate; return $?; fi
  if CompWordsContainsArray "${cmds40[@]}"; then _picocli_sslteam_ca_intermediate_revoke; return $?; fi
  if CompWordsContainsArray "${cmds39[@]}"; then _picocli_sslteam_ca_intermediate_retire; return $?; fi
  if CompWordsContainsArray "${cmds38[@]}"; then _picocli_sslteam_ca_intermediate_activate; return $?; fi
  if CompWordsContainsArray "${cmds37[@]}"; then _picocli_sslteam_ca_intermediate_sign; return $?; fi
  if CompWordsContainsArray "${cmds36[@]}"; then _picocli_sslteam_ca_intermediate_setup; return $?; fi
  if CompWordsContainsArray "${cmds35[@]}"; then _picocli_sslteam_ca_intermediate_create; return $?; fi
  if CompWordsContainsArray "${cmds34[@]}"; then _picocli_sslteam_ca_intermediate_download; return $?; fi
  if CompWordsContainsArray "${cmds33[@]}"; then _picocli_sslteam_ca_intermediate_status; return $?; fi
  if CompWordsContainsArray "${cmds32[@]}"; then _picocli_sslteam_ca_root_download_certificate; return $?; fi
  if CompWordsContainsArray "${cmds31[@]}"; then _picocli_sslteam_ca_root_revoke; return $?; fi
  if CompWordsContainsArray "${cmds30[@]}"; then _picocli_sslteam_ca_root_retire; return $?; fi
  if CompWordsContainsArray "${cmds29[@]}"; then _picocli_sslteam_ca_root_download; return $?; fi
  if CompWordsContainsArray "${cmds28[@]}"; then _picocli_sslteam_ca_root_setup; return $?; fi
  if CompWordsContainsArray "${cmds27[@]}"; then _picocli_sslteam_ca_root_remove; return $?; fi
  if CompWordsContainsArray "${cmds26[@]}"; then _picocli_sslteam_ca_root_show; return $?; fi
  if CompWordsContainsArray "${cmds25[@]}"; then _picocli_sslteam_ca_root_import; return $?; fi
  if CompWordsContainsArray "${cmds24[@]}"; then _picocli_sslteam_ca_root_create; return $?; fi
  if CompWordsContainsArray "${cmds23[@]}"; then _picocli_sslteam_ca_root_list; return $?; fi
  if CompWordsContainsArray "${cmds22[@]}"; then _picocli_sslteam_ca_trust; return $?; fi
  if CompWordsContainsArray "${cmds21[@]}"; then _picocli_sslteam_ca_intermediate; return $?; fi
  if CompWordsContainsArray "${cmds20[@]}"; then _picocli_sslteam_ca_root; return $?; fi
  if CompWordsContainsArray "${cmds19[@]}"; then _picocli_sslteam_ca_status; return $?; fi
  if CompWordsContainsArray "${cmds18[@]}"; then _picocli_sslteam_tls_forget; return $?; fi
  if CompWordsContainsArray "${cmds17[@]}"; then _picocli_sslteam_tls_replace; return $?; fi
  if CompWordsContainsArray "${cmds16[@]}"; then _picocli_sslteam_tls_show; return $?; fi
  if CompWordsContainsArray "${cmds15[@]}"; then _picocli_sslteam_tls_truststore; return $?; fi
  if CompWordsContainsArray "${cmds14[@]}"; then _picocli_sslteam_tls_tofu; return $?; fi
  if CompWordsContainsArray "${cmds13[@]}"; then _picocli_sslteam_config_show; return $?; fi
  if CompWordsContainsArray "${cmds12[@]}"; then _picocli_sslteam_config_set; return $?; fi
  if CompWordsContainsArray "${cmds11[@]}"; then _picocli_sslteam_auth_logoutall; return $?; fi
  if CompWordsContainsArray "${cmds10[@]}"; then _picocli_sslteam_auth_logout; return $?; fi
  if CompWordsContainsArray "${cmds9[@]}"; then _picocli_sslteam_auth_password; return $?; fi
  if CompWordsContainsArray "${cmds8[@]}"; then _picocli_sslteam_auth_device; return $?; fi
  if CompWordsContainsArray "${cmds7[@]}"; then _picocli_sslteam_cert; return $?; fi
  if CompWordsContainsArray "${cmds6[@]}"; then _picocli_sslteam_ca; return $?; fi
  if CompWordsContainsArray "${cmds5[@]}"; then _picocli_sslteam_tls; return $?; fi
  if CompWordsContainsArray "${cmds4[@]}"; then _picocli_sslteam_completion; return $?; fi
  if CompWordsContainsArray "${cmds3[@]}"; then _picocli_sslteam_config; return $?; fi
  if CompWordsContainsArray "${cmds2[@]}"; then _picocli_sslteam_version; return $?; fi
  if CompWordsContainsArray "${cmds1[@]}"; then _picocli_sslteam_ping; return $?; fi
  if CompWordsContainsArray "${cmds0[@]}"; then _picocli_sslteam_auth; return $?; fi

  # No subcommands were specified; generate completions for the top-level command.
  _picocli_sslteam; return $?;
}

# Generates completions for the options and subcommands of the `sslteam` command.
function _picocli_sslteam() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="auth ping version config completion tls ca cert"
  local flag_opts="'-h' '--help' '-V' '--version'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `auth` subcommand.
function _picocli_sslteam_auth() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="device password logout logout-all"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `ping` subcommand.
function _picocli_sslteam_ping() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--diag'"
  local arg_opts="'--base-url'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `version` subcommand.
function _picocli_sslteam_version() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `config` subcommand.
function _picocli_sslteam_config() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="set show"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `completion` subcommand.
function _picocli_sslteam_completion() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts=""
  local arg_opts=""
  local shell_pos_param_args=("bash" "zsh") # 0-0 values

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local currIndex
    currIndex=$(currentPositionalIndex "completion" "${arg_opts}" "${flag_opts}")
    if (( currIndex >= 0 && currIndex <= 0 )); then
      positionals=$( compReplyArray "${shell_pos_param_args[@]}" )
    fi
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `tls` subcommand.
function _picocli_sslteam_tls() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="tofu trust-store show replace forget"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `ca` subcommand.
function _picocli_sslteam_ca() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="status root intermediate trust"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `cert` subcommand.
function _picocli_sslteam_cert() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="generate inspect list show download artifact revoke revocations"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `device` subcommand.
function _picocli_sslteam_auth_device() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--diag'"
  local arg_opts="'--base-url'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `password` subcommand.
function _picocli_sslteam_auth_password() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--diag'"
  local arg_opts="'--base-url' '--username' '--password' '--password-file' '--new-password-file'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--username')
      return
      ;;
    '--password')
      return
      ;;
    '--password-file')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--new-password-file')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `logout` subcommand.
function _picocli_sslteam_auth_logout() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `logout-all` subcommand.
function _picocli_sslteam_auth_logoutall() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `set` subcommand.
function _picocli_sslteam_config_set() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `show` subcommand.
function _picocli_sslteam_config_show() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `tofu` subcommand.
function _picocli_sslteam_tls_tofu() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--origin' '--fingerprint'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--origin')
      return
      ;;
    '--fingerprint')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `trust-store` subcommand.
function _picocli_sslteam_tls_truststore() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--origin' '--path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--origin')
      return
      ;;
    '--path')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `show` subcommand.
function _picocli_sslteam_tls_show() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--origin'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--origin')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `replace` subcommand.
function _picocli_sslteam_tls_replace() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--origin' '--fingerprint'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--origin')
      return
      ;;
    '--fingerprint')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `forget` subcommand.
function _picocli_sslteam_tls_forget() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--yes'"
  local arg_opts="'--origin'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--origin')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `status` subcommand.
function _picocli_sslteam_ca_status() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `root` subcommand.
function _picocli_sslteam_ca_root() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="list create import show remove setup download retire revoke"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `intermediate` subcommand.
function _picocli_sslteam_ca_intermediate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="status download create setup sign activate retire revoke"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `trust` subcommand.
function _picocli_sslteam_ca_trust() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="install verify remove list"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `list` subcommand.
function _picocli_sslteam_ca_root_list() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `create` subcommand.
function _picocli_sslteam_ca_root_create() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--name' '--algo' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param' '--passphrase'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--name')
      return
      ;;
    '--algo')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
    '--passphrase')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `import` subcommand.
function _picocli_sslteam_ca_root_import() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--name' '--root-cert' '--root-key' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param' '--passphrase'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--name')
      return
      ;;
    '--root-cert')
      return
      ;;
    '--root-key')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
    '--passphrase')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `show` subcommand.
function _picocli_sslteam_ca_root_show() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--name' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param' '--passphrase'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--name')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
    '--passphrase')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `remove` subcommand.
function _picocli_sslteam_ca_root_remove() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--name' '--team-code' '--environment' '--storage-implementation' '--storage-location' '--storage-param' '--confirm'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--name')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--storage-implementation')
      return
      ;;
    '--storage-location')
      return
      ;;
    '--storage-param')
      return
      ;;
    '--confirm')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `setup` subcommand.
function _picocli_sslteam_ca_root_setup() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--common-name' '--organization' '--organizational-unit' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--common-name')
      return
      ;;
    '--organization')
      return
      ;;
    '--organizational-unit')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `download` subcommand.
function _picocli_sslteam_ca_root_download() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="certificate"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `retire` subcommand.
function _picocli_sslteam_ca_root_retire() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--root-id' '--confirm' '--reason'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--root-id')
      return
      ;;
    '--confirm')
      return
      ;;
    '--reason')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `revoke` subcommand.
function _picocli_sslteam_ca_root_revoke() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--root-id' '--confirm' '--reason'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--root-id')
      return
      ;;
    '--confirm')
      return
      ;;
    '--reason')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `certificate` subcommand.
function _picocli_sslteam_ca_root_download_certificate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--force'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `status` subcommand.
function _picocli_sslteam_ca_intermediate_status() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `download` subcommand.
function _picocli_sslteam_ca_intermediate_download() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="certificate chain"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `create` subcommand.
function _picocli_sslteam_ca_intermediate_create() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--replace-active'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--name' '--algorithm' '--subject-dn' '--csr-out' '--manifest-out'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--name')
      return
      ;;
    '--algorithm')
      return
      ;;
    '--subject-dn')
      return
      ;;
    '--csr-out')
      return
      ;;
    '--manifest-out')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `setup` subcommand.
function _picocli_sslteam_ca_intermediate_setup() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--replace-active'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--name' '--subject-dn' '--algorithm' '--backup' '--csr-out' '--cert-out' '--chain-out'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--name')
      return
      ;;
    '--subject-dn')
      return
      ;;
    '--algorithm')
      return
      ;;
    '--backup')
      return
      ;;
    '--csr-out')
      return
      ;;
    '--cert-out')
      return
      ;;
    '--chain-out')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `sign` subcommand.
function _picocli_sslteam_ca_intermediate_sign() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--upload' '--replace-active'"
  local arg_opts="'--base-url' '--backup' '--manifest'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--backup')
      return
      ;;
    '--manifest')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `activate` subcommand.
function _picocli_sslteam_ca_intermediate_activate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--replace-active'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--name' '--request-id' '--intermediate-cert' '--chain'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--name')
      return
      ;;
    '--request-id')
      return
      ;;
    '--intermediate-cert')
      return
      ;;
    '--chain')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `retire` subcommand.
function _picocli_sslteam_ca_intermediate_retire() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--intermediate-id' '--confirm' '--reason'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--intermediate-id')
      return
      ;;
    '--confirm')
      return
      ;;
    '--reason')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `revoke` subcommand.
function _picocli_sslteam_ca_intermediate_revoke() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--intermediate-id' '--confirm' '--reason'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--intermediate-id')
      return
      ;;
    '--confirm')
      return
      ;;
    '--reason')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `certificate` subcommand.
function _picocli_sslteam_ca_intermediate_download_certificate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--force'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `chain` subcommand.
function _picocli_sslteam_ca_intermediate_download_chain() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--force'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `install` subcommand.
function _picocli_sslteam_ca_trust_install() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--java'"
  local arg_opts="'--target' '--certificate' '--confirm-fingerprint' '--profile'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--target')
      return
      ;;
    '--certificate')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--confirm-fingerprint')
      return
      ;;
    '--profile')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `verify` subcommand.
function _picocli_sslteam_ca_trust_verify() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--java'"
  local arg_opts="'--target' '--certificate' '--confirm-fingerprint' '--profile'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--target')
      return
      ;;
    '--certificate')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--confirm-fingerprint')
      return
      ;;
    '--profile')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `remove` subcommand.
function _picocli_sslteam_ca_trust_remove() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--java'"
  local arg_opts="'--target' '--certificate' '--confirm-fingerprint' '--profile'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--target')
      return
      ;;
    '--certificate')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--confirm-fingerprint')
      return
      ;;
    '--profile')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `list` subcommand.
function _picocli_sslteam_ca_trust_list() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--java' '--sslteam'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--target' '--profile'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--target')
      return
      ;;
    '--profile')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `generate` subcommand.
function _picocli_sslteam_cert_generate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--generate-password' '--show-generated-password'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--name' '--common-name' '--san' '--days' '--output-profile' '--algorithm' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--name')
      return
      ;;
    '--common-name')
      return
      ;;
    '--san')
      return
      ;;
    '--days')
      return
      ;;
    '--output-profile')
      return
      ;;
    '--algorithm')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `inspect` subcommand.
function _picocli_sslteam_cert_inspect() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--sslteam'"
  local arg_opts="'--certificate'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--certificate')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `list` subcommand.
function _picocli_sslteam_cert_list() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `show` subcommand.
function _picocli_sslteam_cert_show() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--issuance-id'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--issuance-id')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `download` subcommand.
function _picocli_sslteam_cert_download() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="certificate chain"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `artifact` subcommand.
function _picocli_sslteam_cert_artifact() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--generate-password' '--show-generated-password'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--issuance-id' '--output-profile' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--issuance-id')
      return
      ;;
    '--output-profile')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `revoke` subcommand.
function _picocli_sslteam_cert_revoke() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--purge-local'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--issuance-id' '--confirm' '--reason' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--issuance-id')
      return
      ;;
    '--confirm')
      return
      ;;
    '--reason')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `revocations` subcommand.
function _picocli_sslteam_cert_revocations() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts=""
  local arg_opts="'--base-url' '--team-code' '--environment' '--limit'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--limit')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `certificate` subcommand.
function _picocli_sslteam_cert_download_certificate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--force'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--issuance-id' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--issuance-id')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `chain` subcommand.
function _picocli_sslteam_cert_download_chain() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--force'"
  local arg_opts="'--base-url' '--team-code' '--environment' '--issuance-id' '--out-dir'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--base-url')
      return
      ;;
    '--team-code')
      return
      ;;
    '--environment')
      return
      ;;
    '--issuance-id')
      return
      ;;
    '--out-dir')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Define a completion specification (a compspec) for the
# `sslteam`, `sslteam.sh`, and `sslteam.bash` commands.
# Uses the bash `complete` builtin (see [6]) to specify that shell function
# `_complete_sslteam` is responsible for generating possible completions for the
# current word on the command line.
# The `-o default` option means that if the function generated no matches, the
# default Bash completions and the Readline default filename completions are performed.
complete -F _complete_sslteam -o default sslteam sslteam.sh sslteam.bash
