#compdef tmuxp

# AUTOMATICALLY GENERATED by `shtab`


_shtab_tmuxp_commands() {
  local _commands=(
    "convert:Convert workspace files between YAML and JSON format."
    "debug-info:Print diagnostic information for debugging and issue reports."
    "edit:Open tmuxp workspace file in your system editor (\$EDITOR)."
    "freeze:Freeze a live tmux session to a tmuxp workspace file."
    "import:Import workspaces from teamocil and tmuxinator configuration files."
    "load:Load tmuxp workspace file(s) and create or attach to a tmux session."
    "ls:List workspace files in the tmuxp configuration directory."
    "search:Search workspace files by name, session, path, window, or pane content."
    "shell:Launch interactive Python shell with tmux server, session, window and pane."
  )
  _describe 'tmuxp commands' _commands
}

_shtab_tmuxp_import_commands() {
  local _commands=(
    "teamocil:"
    "tmuxinator:"
  )
  _describe 'tmuxp import commands' _commands
}

_shtab_tmuxp_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)"{--version,-V}"[show program\'s version number and exit]"
  "--log-level[log level (debug, info, warning, error, critical) (default \"info\")]:log_level:(debug info warning error critical)"
  "--color[when to use colors\: auto (default), always, or never]:color:(auto always never)"
)

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

_shtab_tmuxp_convert_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {--yes,-y}"[always answer yes]"
  ":checks tmuxp and current directory for workspace files.:_files"
)

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

_shtab_tmuxp_debug_info_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "--json[output as JSON]"
)

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

_shtab_tmuxp_edit_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  ":checks current tmuxp and current directory for workspace files.:"
)

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

_shtab_tmuxp_freeze_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "-S[pass-through for tmux -S]:socket_path:"
  "-L[pass-through for tmux -L]:socket_name:"
  {-f,--workspace-format}"[format to save in]:workspace_format:(yaml json)"
  {-o,--save-to}"[file to save to]:save_to:"
  {--yes,-y}"[always answer yes]"
  {--quiet,-q}"[don\'t prompt for confirmation]"
  "--force[overwrite the workspace file]"
  ":session_name:"
)

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

_shtab_tmuxp_import_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
)

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

_shtab_tmuxp_import_teamocil_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  ":checks current \~\/.teamocil and current directory for yaml files:_files"
)

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

_shtab_tmuxp_import_tmuxinator_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  ":checks current \~\/.tmuxinator and current directory for yaml files:_files"
)

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

_shtab_tmuxp_load_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "-L[passthru to tmux(1) -L]:socket_name:"
  "-S[passthru to tmux(1) -S]:socket_path:"
  "-f[passthru to tmux(1) -f]:tmux_config_file:_files"
  "-s[start new session with new session name]:new_session_name:"
  {--yes,-y}"[always answer yes]"
  "-d[load the session without attaching it]"
  {-a,--append}"[load workspace, appending windows to the current session]"
  "-2[force tmux to assume the terminal supports 256 colours.]"
  "-8[like -2, but indicates that the terminal supports 88 colours.]"
  "--log-file[file to log errors\/output to]:log_file:_files"
  "(*):filepath to session or filename of session in tmuxp workspace directory:_files"
)

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

_shtab_tmuxp_ls_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "--tree[display workspaces grouped by directory]"
  "--json[output as JSON]"
  "--ndjson[output as NDJSON (one JSON per line)]"
  "--full[include full config content in output]"
)

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

_shtab_tmuxp_search_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "*"{-f,--field}"[restrict search to field(s)\: name, session\/s, path\/p, window\/w, pane]:field:"
  {-i,--ignore-case}"[case-insensitive matching]"
  {-S,--smart-case}"[case-insensitive unless pattern has uppercase]"
  {-F,--fixed-strings}"[treat patterns as literal strings, not regex]"
  {-w,--word-regexp}"[match whole words only]"
  {-v,--invert-match}"[show workspaces that do NOT match]"
  "--any[match ANY pattern (OR logic)\; default is ALL (AND logic)]"
  "--json[output as JSON]"
  "--ndjson[output as NDJSON (one JSON per line)]"
  "(*)::search patterns (prefix with field\: for field-scoped search):"
)

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

_shtab_tmuxp_shell_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "-S[pass-through for tmux -S]:socket_path:"
  "-L[pass-through for tmux -L]:socket_name:"
  "-c[instead of opening shell, execute python code in libtmux and exit]:command:"
  "--best[use best shell available in site packages]"
  "--pdb[use plain pdb]"
  "--code[use stdlib\'s code.interact()]"
  "--ptipython[use ptpython \+ ipython]"
  "--ptpython[use ptpython]"
  "--ipython[use ipython]"
  "--bpython[use bpython]"
  "--use-pythonrc[load PYTHONSTARTUP env var and \~\/.pythonrc.py script in --code]"
  "--no-startup[load PYTHONSTARTUP env var and \~\/.pythonrc.py script in --code]"
  "--use-vi-mode[use vi-mode in ptpython\/ptipython]"
  "--no-vi-mode[use vi-mode in ptpython\/ptipython]"
  ":session_name:"
  ":window_name:"
)

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


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

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

  case $state in
    tmuxp)
      words=($line[1] "${words[@]}")
      (( CURRENT += 1 ))
      curcontext="${curcontext%:*:*}:_shtab_tmuxp-$line[1]:"
      case $line[1] in
        convert) _arguments -C -s $_shtab_tmuxp_convert_options ;;
        debug-info) _arguments -C -s $_shtab_tmuxp_debug_info_options ;;
        edit) _arguments -C -s $_shtab_tmuxp_edit_options ;;
        freeze) _arguments -C -s $_shtab_tmuxp_freeze_options ;;
        import) _shtab_tmuxp_import ;;
        load) _arguments -C -s $_shtab_tmuxp_load_options ;;
        ls) _arguments -C -s $_shtab_tmuxp_ls_options ;;
        search) _arguments -C -s $_shtab_tmuxp_search_options ;;
        shell) _arguments -C -s $_shtab_tmuxp_shell_options ;;
      esac
  esac
}

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

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

  case $state in
    import)
      words=($line[1] "${words[@]}")
      (( CURRENT += 1 ))
      curcontext="${curcontext%:*:*}:_shtab_tmuxp_import-$line[1]:"
      case $line[1] in
        teamocil) _arguments -C -s $_shtab_tmuxp_import_teamocil_options ;;
        tmuxinator) _arguments -C -s $_shtab_tmuxp_import_tmuxinator_options ;;
      esac
  esac
}



typeset -A opt_args

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

