Implement suggestions: reduced code for session selection, fixed --help etc.
This commit is contained in:
parent
630edf185b
commit
d0dcdb632e
17
src/_tmuxp
17
src/_tmuxp
|
@ -47,8 +47,8 @@ _tmuxp() {
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
":command:->command" \
|
":command:->command" \
|
||||||
"*::options:->options" \
|
"*::options:->options" \
|
||||||
"--log_level:Log level:(DEBUG INFO WARNING ERROR CRITICAL)" \
|
"--log_level:log level:(DEBUG INFO WARNING ERROR CRITICAL)" \
|
||||||
"--help:Show help"
|
"--help[display usage information]"
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
(command)
|
(command)
|
||||||
|
@ -71,7 +71,7 @@ _tmuxp() {
|
||||||
;;
|
;;
|
||||||
(freeze)
|
(freeze)
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
'1:: :{_wanted tmux-sessions exp "session name" compadd $(tmux ls -F "#{session_name}")}'
|
'1::session name:compadd $(command tmux ls -F "#{session_name}")'
|
||||||
;;
|
;;
|
||||||
(convert)
|
(convert)
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
|
@ -98,14 +98,9 @@ __tmuxp_load() {
|
||||||
case $state in
|
case $state in
|
||||||
(sessions)
|
(sessions)
|
||||||
local s
|
local s
|
||||||
_wanted user-sessions expl 'User sessions' compadd \
|
_alternative \
|
||||||
$(
|
'sessions-user:user session:compadd -F line - ~/.tmuxp/*.(json|yml|yaml)(:r:t)' \
|
||||||
for file in ~/.tmuxp/*.(json|yml|yaml)
|
'sessions-other:session in current directory:_path_files -g "**/*.(json|yaml|yml)(-.)"'
|
||||||
do
|
|
||||||
s=${file:t:r}
|
|
||||||
[[ -z "${line[(r)$s]}" ]] && echo $s
|
|
||||||
done)
|
|
||||||
_wanted sessions expl 'Other sessions' compadd $(for file in ./*.(json|yaml|yml); do echo $file; done)
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue