#compdef keyring

# AUTOMATICALLY GENERATED by `shtab`


_shtab_keyring_commands() {
  local _commands=(
    
  )
  _describe 'keyring commands' _commands
}

_shtab_keyring_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-p,--keyring-path}"[Path to the keyring backend]:keyring_path:_files -/"
  {-b,--keyring-backend}"[Name of the keyring backend]:keyring_backend:backend_complete"
  "--list-backends[List keyring backends and exit]"
  "--disable[Disable keyring and exit]"
  "--mode[
            Mode for \'get\' operation.
            \'password\' requires a username and will return only the password.
            \'creds\' does not require a username and will return both the username and password separated by a newline.

            Default is \'password\'
            ]:get_mode:(password creds)"
  "--output[
            Output format for \'get\' operation.

            Default is \'plain\'
            ]:output_format:(plain json)"
  "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
  ":service:"
  ":username:"
  ":operation:(get set del diagnose)"
)


_shtab_keyring() {
  local context state line curcontext="$curcontext" one_or_more='(-)*' remainder='(*)'

  if ((${_shtab_keyring_options[(I)${(q)one_or_more}*]} + ${_shtab_keyring_options[(I)${(q)remainder}*]} == 0)); then  # noqa: E501
    _shtab_keyring_options+=(': :_shtab_keyring_commands' '*::: :->keyring')
  fi
  _arguments -C -s $_shtab_keyring_options

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

# Custom Preamble
# Complete keyring backends for `keyring -b` from `keyring --list-backends`
# % keyring -b <TAB>
# keyring priority
# keyring.backends.chainer.ChainerBackend   10
# keyring.backends.fail.Keyring             0
# ...                                       ...

backend_complete() {
	local line
	while read -r line; do
		choices+=(${${line/ \(priority: /\\\\:}/)/})
	done <<< "$($words[1] --list-backends)"
	_arguments "*:keyring priority:(($choices))"
}

# End Custom Preamble


typeset -A opt_args

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

