parent
f103e01de0
commit
530a4f68ed
50
src/_tmuxp
50
src/_tmuxp
|
|
@ -40,8 +40,7 @@
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
_tmuxp() {
|
_tmuxp() {
|
||||||
|
local curcontext="$curcontext" state line ret=1
|
||||||
local curcontext="$curcontext" state line
|
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
|
|
@ -49,12 +48,12 @@ _tmuxp() {
|
||||||
"*::options:->options" \
|
"*::options:->options" \
|
||||||
"--log-level[log level(default info)]: :(debug info warning error critical)" \
|
"--log-level[log level(default info)]: :(debug info warning error critical)" \
|
||||||
'(- *)'{-h,--help}'[display usage information]' \
|
'(- *)'{-h,--help}'[display usage information]' \
|
||||||
'(- *)'{-V,--version}'[show version number and exit]'
|
'(- *)'{-V,--version}'[show version number and exit]' \
|
||||||
|
&& ret=0
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
(command)
|
(command)
|
||||||
local -a subcommands
|
local -a subcommands=(
|
||||||
subcommands=(
|
|
||||||
'load:Load tmuxp workspaces'
|
'load:Load tmuxp workspaces'
|
||||||
'shell:launch python shell for tmux server, session, window and pane'
|
'shell:launch python shell for tmux server, session, window and pane'
|
||||||
'import:Import a teamocil/tmuxinator config'
|
'import:Import a teamocil/tmuxinator config'
|
||||||
|
|
@ -64,19 +63,19 @@ _tmuxp() {
|
||||||
'edit: run $EDITOR on config'
|
'edit: run $EDITOR on config'
|
||||||
'freeze:Snapshot a session into a config'
|
'freeze:Snapshot a session into a config'
|
||||||
)
|
)
|
||||||
_describe -t commands 'commands' subcommands
|
_describe -t commands 'commands' subcommands && ret=0
|
||||||
;;
|
;;
|
||||||
(options)
|
(options)
|
||||||
case $line[1] in
|
case $line[1] in
|
||||||
(load)
|
(load)
|
||||||
__tmuxp_load
|
__tmuxp_load && ret=0
|
||||||
;;
|
;;
|
||||||
(import)
|
(import)
|
||||||
__tmuxp_import
|
__tmuxp_import && ret=0
|
||||||
;;
|
;;
|
||||||
(freeze)
|
(freeze)
|
||||||
local sessions="$(__tmux_sessions)"
|
local sessions="$(__tmux_sessions)"
|
||||||
_arguments -C \
|
_arguments \
|
||||||
'(- *)'{-h,--help}'[show help message and exit]' \
|
'(- *)'{-h,--help}'[show help message and exit]' \
|
||||||
'-S[pass-through for tmux -S]: :_files' \
|
'-S[pass-through for tmux -S]: :_files' \
|
||||||
'-L[pass-through for tmux -L]: :' \
|
'-L[pass-through for tmux -L]: :' \
|
||||||
|
|
@ -85,16 +84,18 @@ _tmuxp() {
|
||||||
'(-y --yes)'{-y,--yes}'[always answer yes]' \
|
'(-y --yes)'{-y,--yes}'[always answer yes]' \
|
||||||
'(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
|
'(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
|
||||||
'--force[overwrite the config file]'\
|
'--force[overwrite the config file]'\
|
||||||
"1::session name:compadd $sessions"
|
"1::session name:compadd $sessions" \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(convert)
|
(convert)
|
||||||
_arguments -C \
|
_arguments \
|
||||||
'1:: :_files -g "*.(json|yaml|yml)"'
|
'1:: :_files -g "*.(json|yaml|yml)"' \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(shell)
|
(shell)
|
||||||
local sessions="$(__tmux_sessions)"
|
local sessions="$(__tmux_sessions)"
|
||||||
local windows="$(__tmux_windows)"
|
local windows="$(__tmux_windows)"
|
||||||
_arguments -C \
|
_arguments \
|
||||||
'(- *)'{-h,--help}'[show help message and exit]' \
|
'(- *)'{-h,--help}'[show help message and exit]' \
|
||||||
'-S[pass-through for tmux -S]: :_files' \
|
'-S[pass-through for tmux -S]: :_files' \
|
||||||
'-L[pass-through for tmux -L]: :' \
|
'-L[pass-through for tmux -L]: :' \
|
||||||
|
|
@ -105,25 +106,29 @@ _tmuxp() {
|
||||||
'--ptpython[use ptpython]' \
|
'--ptpython[use ptpython]' \
|
||||||
'--ipython[use ipython]' \
|
'--ipython[use ipython]' \
|
||||||
'--bpython[use bpython]' \
|
'--bpython[use bpython]' \
|
||||||
(--no-startup)'--use-pythonrc[load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
|
'(--no-startup --use-pythonrc)--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-startup --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]' \
|
'(--use-vi-mode --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]' \
|
'(--use-vi-mode --no-vi-mode)--no-vi-mode[do not use vi-mode in ptpython/ptipython]' \
|
||||||
"1::session name:compadd $sessions" \
|
"1::session name:compadd $sessions" \
|
||||||
"2::window name:compadd $windows"
|
"2::window name:compadd $windows" \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(ls|debug-info)
|
(ls|debug-info)
|
||||||
_arguments -C \
|
_arguments \
|
||||||
'(- *)'{-h,--help}'[show help message and exit]'
|
'(- *)'{-h,--help}'[show help message and exit]' \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(edit)
|
(edit)
|
||||||
_arguments -C \
|
_arguments \
|
||||||
'(- *)'{-h,--help}'[show help message and exit]' \
|
'(- *)'{-h,--help}'[show help message and exit]' \
|
||||||
'1:: :_files -g "*.(json|yaml|yml)"'
|
'1:: :_files -g "*.(json|yaml|yml)"' \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
__tmuxp_load() {
|
__tmuxp_load() {
|
||||||
|
|
@ -188,7 +193,6 @@ __tmux_windows () {
|
||||||
|
|
||||||
_tmuxp "$@"
|
_tmuxp "$@"
|
||||||
|
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# mode: Shell-Script
|
# mode: Shell-Script
|
||||||
# sh-indentation: 2
|
# sh-indentation: 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue