aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShohei YOSHIDA <syohex@gmail.com>2026-03-08 21:40:00 +0900
committerShohei YOSHIDA <syohex@gmail.com>2026-03-08 21:40:00 +0900
commit530a4f68edde078c8cc2e6d5882e40bcc2f08720 (patch)
treec9370e35f51dbdecb16e2a36bc415802455f928c /src
parentfix tox completion (diff)
downloadzsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar.gz
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar.bz2
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar.lz
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar.xz
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.tar.zst
zsh-completions-530a4f68edde078c8cc2e6d5882e40bcc2f08720.zip
fix tmuxp completion
- fix wrong exclusive options
Diffstat (limited to 'src')
-rw-r--r--src/_tmuxp156
1 files changed, 80 insertions, 76 deletions
diff --git a/src/_tmuxp b/src/_tmuxp
index be221e9..0794f15 100644
--- a/src/_tmuxp
+++ b/src/_tmuxp
@@ -40,8 +40,7 @@
# ------------------------------------------------------------------------------
_tmuxp() {
-
- local curcontext="$curcontext" state line
+ local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
@@ -49,81 +48,87 @@ _tmuxp() {
"*::options:->options" \
"--log-level[log level(default info)]: :(debug info warning error critical)" \
'(- *)'{-h,--help}'[display usage information]' \
- '(- *)'{-V,--version}'[show version number and exit]'
+ '(- *)'{-V,--version}'[show version number and exit]' \
+ && ret=0
- case $state in
- (command)
- local -a subcommands
- subcommands=(
- 'load:Load tmuxp workspaces'
- 'shell:launch python shell for tmux server, session, window and pane'
- 'import:Import a teamocil/tmuxinator config'
- 'convert:Convert a tmuxp config between JSON and YAML'
- 'debug-info:print out all diagnostic info'
- 'ls:list sessions in config directory'
- 'edit: run $EDITOR on config'
- 'freeze:Snapshot a session into a config'
- )
- _describe -t commands 'commands' subcommands
- ;;
- (options)
- case $line[1] in
- (load)
- __tmuxp_load
- ;;
- (import)
- __tmuxp_import
- ;;
- (freeze)
- local sessions="$(__tmux_sessions)"
- _arguments -C \
- '(- *)'{-h,--help}'[show help message and exit]' \
- '-S[pass-through for tmux -S]: :_files' \
- '-L[pass-through for tmux -L]: :' \
- '(-f --config-format)'{-f,--config-format}'[format to save in]: :(yaml json)' \
- '(-o --save-to)'{-o,--save-to}'[file to save to]: :_files' \
- '(-y --yes)'{-y,--yes}'[always answer yes]' \
- '(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
- '--force[overwrite the config file]'\
- "1::session name:compadd $sessions"
- ;;
- (convert)
- _arguments -C \
- '1:: :_files -g "*.(json|yaml|yml)"'
- ;;
- (shell)
- local sessions="$(__tmux_sessions)"
- local windows="$(__tmux_windows)"
- _arguments -C \
- '(- *)'{-h,--help}'[show help message and exit]' \
- '-S[pass-through for tmux -S]: :_files' \
- '-L[pass-through for tmux -L]: :' \
- '--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]' \
- (--no-startup)'--use-pythonrc[load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
- (--use-pythonrc)'--no-startup[do not load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
- (--no-vi-mode)'--use-vi-mode[use vi-mode in ptpython/ptipython]' \
- (--vi-mode)'--no-vi-mode[do not use vi-mode in ptpython/ptipython]' \
- "1::session name:compadd $sessions" \
- "2::window name:compadd $windows"
- ;;
- (ls|debug-info)
- _arguments -C \
- '(- *)'{-h,--help}'[show help message and exit]'
- ;;
- (edit)
- _arguments -C \
- '(- *)'{-h,--help}'[show help message and exit]' \
- '1:: :_files -g "*.(json|yaml|yml)"'
- ;;
- esac
- esac
+ case $state in
+ (command)
+ local -a subcommands=(
+ 'load:Load tmuxp workspaces'
+ 'shell:launch python shell for tmux server, session, window and pane'
+ 'import:Import a teamocil/tmuxinator config'
+ 'convert:Convert a tmuxp config between JSON and YAML'
+ 'debug-info:print out all diagnostic info'
+ 'ls:list sessions in config directory'
+ 'edit: run $EDITOR on config'
+ 'freeze:Snapshot a session into a config'
+ )
+ _describe -t commands 'commands' subcommands && ret=0
+ ;;
+ (options)
+ case $line[1] in
+ (load)
+ __tmuxp_load && ret=0
+ ;;
+ (import)
+ __tmuxp_import && ret=0
+ ;;
+ (freeze)
+ local sessions="$(__tmux_sessions)"
+ _arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ '-S[pass-through for tmux -S]: :_files' \
+ '-L[pass-through for tmux -L]: :' \
+ '(-f --config-format)'{-f,--config-format}'[format to save in]: :(yaml json)' \
+ '(-o --save-to)'{-o,--save-to}'[file to save to]: :_files' \
+ '(-y --yes)'{-y,--yes}'[always answer yes]' \
+ '(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
+ '--force[overwrite the config file]'\
+ "1::session name:compadd $sessions" \
+ && ret=0
+ ;;
+ (convert)
+ _arguments \
+ '1:: :_files -g "*.(json|yaml|yml)"' \
+ && ret=0
+ ;;
+ (shell)
+ local sessions="$(__tmux_sessions)"
+ local windows="$(__tmux_windows)"
+ _arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ '-S[pass-through for tmux -S]: :_files' \
+ '-L[pass-through for tmux -L]: :' \
+ '--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]' \
+ '(--no-startup --use-pythonrc)--use-pythonrc[load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
+ '(--no-startup --use-pythonrc)--no-startup[do not load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
+ '(--use-vi-mode --no-vi-mode)--use-vi-mode[use vi-mode in ptpython/ptipython]' \
+ '(--use-vi-mode --no-vi-mode)--no-vi-mode[do not use vi-mode in ptpython/ptipython]' \
+ "1::session name:compadd $sessions" \
+ "2::window name:compadd $windows" \
+ && ret=0
+ ;;
+ (ls|debug-info)
+ _arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ && ret=0
+ ;;
+ (edit)
+ _arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ '1:: :_files -g "*.(json|yaml|yml)"' \
+ && ret=0
+ ;;
+ esac
+ esac
+ return ret
}
__tmuxp_load() {
@@ -188,7 +193,6 @@ __tmux_windows () {
_tmuxp "$@"
-
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2