#compdef pudb

# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab
# Usage:
# 1) Copy this to a file named _pudb (e.g. ~/.local/share/zsh_completion/_pudb).
# 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_pudb_commands() {
  local _commands=(
    
  )
  _describe 'pudb commands' _commands
}

_shtab_pudb_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh fish powershell)"
  {-c,--continue}"[Let the script run until an exception occurs or a breakpoint is hit]"
  {-s,--steal-output}"[Redirect the debugged program\'s stdout\/stderr into pudb (note\: not yet implemented)]"
  {-m,--module}"[Debug as module or package instead of as a script]"
  {-le,--log-errors}"[Log internal errors to the given file]:FILE:_files"
  "--pre-run[Run command before each program run]:COMMAND:{_command_names -e}"
  "(- : *)--version[show program\'s version number and exit]"
  "(-)*::Arguments to pass to script or module:_script_args"
)

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


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

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

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

# Custom Preamble
_script_args() {
  # pudb -m <TAB>
  if (($words[(I)-m] == $#words - 1)); then
    _python_modules
  # pudb -m XXX <TAB>
  elif (($words[(I)-m])); then
    _files
  # pudb <TAB>
  else
    _arguments -S -s '(-)1:script_args:_files -g "*.py"' '*: :_files'
  fi
}

# End Custom Preamble


typeset -A opt_args

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

