1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-22 21:01:36 +03:00

docs for activate-pane-direction

* Enhance usage info in `wezterm cli activate-pane-direction --help` by
  showing the variants.
* Update shell completions
* docs and changelog entry
This commit is contained in:
Wez Furlong 2022-09-20 08:46:39 -07:00
parent 36f47ec3f6
commit da13cf69fa
7 changed files with 66 additions and 16 deletions

View File

@ -12,6 +12,9 @@ _wezterm() {
"$1")
cmd="wezterm"
;;
activate-pane-direction)
cmd+="__activate__pane__direction"
;;
cli)
cmd+="__cli"
;;
@ -104,7 +107,7 @@ _wezterm() {
return 0
;;
wezterm__cli)
opts="-h --no-auto-start --prefer-mux --class --help list list-clients proxy tlscreds move-pane-to-new-tab split-pane spawn send-text help"
opts="-h --no-auto-start --prefer-mux --class --help list list-clients proxy tlscreds move-pane-to-new-tab split-pane spawn send-text activate-pane-direction help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@ -121,6 +124,20 @@ _wezterm() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
wezterm__cli__activate__pane__direction)
opts="-h --help Up Down Left Right Next Prev"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
wezterm__cli__help)
opts="<SUBCOMMAND>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then

View File

@ -43,21 +43,22 @@ complete -c wezterm -n "__fish_seen_subcommand_from ls-fonts" -s h -l help -d 'P
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -l key-table -d 'In lua mode, show only the named key table' -r
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -l lua -d 'Show the keys as lua config statements'
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -l class -d 'When connecting to a gui instance, if you started the gui with `--class SOMETHING`, you should also pass that same value here in order for the client to find the correct gui instance' -r
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -l no-auto-start -d 'Don\'t automatically start the server'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -l prefer-mux -d 'Prefer connecting to a background mux server. The default is to prefer connecting to a running wezterm gui instance'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "list" -d 'list windows, tabs and panes'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "list-clients" -d 'list clients'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "proxy" -d 'start rpc proxy pipe'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "tlscreds" -d 'obtain tls credentials'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "move-pane-to-new-tab" -d 'Move a pane into a new tab'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "split-pane" -d 'split the current pane.
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -l class -d 'When connecting to a gui instance, if you started the gui with `--class SOMETHING`, you should also pass that same value here in order for the client to find the correct gui instance' -r
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -l no-auto-start -d 'Don\'t automatically start the server'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -l prefer-mux -d 'Prefer connecting to a background mux server. The default is to prefer connecting to a running wezterm gui instance'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "list" -d 'list windows, tabs and panes'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "list-clients" -d 'list clients'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "proxy" -d 'start rpc proxy pipe'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "tlscreds" -d 'obtain tls credentials'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "move-pane-to-new-tab" -d 'Move a pane into a new tab'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "split-pane" -d 'split the current pane.
Outputs the pane-id for the newly created pane on success'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "spawn" -d 'Spawn a command into a new window or tab
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "spawn" -d 'Spawn a command into a new window or tab
Outputs the pane-id for the newly created pane on success'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "send-text" -d 'Send text to a pane as though it were pasted. If bracketed paste mode is enabled in the pane, then the text will be sent as a bracketed paste'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "send-text" -d 'Send text to a pane as though it were pasted. If bracketed paste mode is enabled in the pane, then the text will be sent as a bracketed paste'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "activate-pane-direction" -d 'Activate an adjacent pane in the specified direction'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from activate-pane-direction; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from list" -l format -d 'Controls the output format. "table" and "json" are possible formats' -r
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from list-clients" -l format -d 'Controls the output format. "table" and "json" are possible formats' -r
@ -91,6 +92,7 @@ complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcomm
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from send-text" -l pane-id -d 'Specify the target pane. The default is to use the current pane based on the environment variable WEZTERM_PANE' -r
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from send-text" -l no-paste -d 'Send the text directly, rather than as a bracketed paste'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from send-text" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from activate-pane-direction" -s h -l help -d 'Print help information'
complete -c wezterm -n "__fish_seen_subcommand_from imgcat" -l width -d 'Specify the display width; defaults to "auto" which automatically selects an appropriate size. You may also use an integer value `N` to specify the number of cells, or `Npx` to specify the number of pixels, or `N%` to size relative to the terminal width' -r
complete -c wezterm -n "__fish_seen_subcommand_from imgcat" -l height -d 'Specify the display height; defaults to "auto" which automatically selects an appropriate size. You may also use an integer value `N` to specify the number of cells, or `Npx` to specify the number of pixels, or `N%` to size relative to the terminal height' -r
complete -c wezterm -n "__fish_seen_subcommand_from imgcat" -l no-preserve-aspect-ratio -d 'Do not respect the aspect ratio. The default is to respect the aspect ratio'

View File

@ -188,6 +188,13 @@ _arguments "${_arguments_options[@]}" \
'::text -- The text to send. If omitted, will read the text from stdin:' \
&& ret=0
;;
(activate-pane-direction)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':direction -- The direction to switch to:(Up Down Left Right Next Prev)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
@ -266,6 +273,11 @@ _wezterm_commands() {
)
_describe -t commands 'wezterm commands' commands "$@"
}
(( $+functions[_wezterm__cli__activate-pane-direction_commands] )) ||
_wezterm__cli__activate-pane-direction_commands() {
local commands; commands=()
_describe -t commands 'wezterm cli activate-pane-direction commands' commands "$@"
}
(( $+functions[_wezterm__cli_commands] )) ||
_wezterm__cli_commands() {
local commands; commands=(
@ -279,6 +291,7 @@ Outputs the pane-id for the newly created pane on success' \
'spawn:Spawn a command into a new window or tab
Outputs the pane-id for the newly created pane on success' \
'send-text:Send text to a pane as though it were pasted. If bracketed paste mode is enabled in the pane, then the text will be sent as a bracketed paste' \
'activate-pane-direction:Activate an adjacent pane in the specified direction' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'wezterm cli commands' commands "$@"

View File

@ -27,6 +27,9 @@ As features stabilize some brief notes about them will accumulate here.
* Preliminary support for `modifyOtherKeys` keyboard encoding
[#2527](https://github.com/wez/wezterm/issues/2527)
* Superscript and subscript text attributes via SGR 73 and SGR 74
* [wezterm cli activate-pane-direction](cli/cli/activate-pane-direction.md)
command. Thanks to [@abusch](https://github.com/abusch)!
[#2526](https://github.com/wez/wezterm/pull/2526)
#### Fixed
* Wayland: key repeat gets stuck after pressing two keys in quick succession.

View File

@ -0,0 +1,14 @@
# `wezterm cli activate-pane-direction DIRECTION`
*Since: nightly builds only*
*Run `wezterm cli activate-pane-direction --help` to see more help*
Changes the activate pane to the one in the specified direction.
Possible values for `DIRECTION` are shown below; the direction is matched
ignoring case so you can use `left` rather than `Left`:
* `Left`, `Right`, `Up`, `Down` to activate based on direction
* `Next`, `Prev` to cycle based on the ordinal position in the pane tree.

View File

@ -331,7 +331,7 @@ fn derive_enum(input: &DeriveInput, enumeration: &DataEnum) -> Result<TokenStrea
}
impl #ident {
fn variants() -> &'static [&'static str] {
pub fn variants() -> &'static [&'static str] {
&[
#( #variant_names, )*
]

View File

@ -372,7 +372,8 @@ Outputs the pane-id for the newly created pane on success"
#[clap(name = "activate-pane-direction", rename_all = "kebab")]
ActivatePaneDirection {
/// The direction to switch to.
#[clap(parse(try_from_str = PaneDirection::direction_from_str))]
#[clap(parse(try_from_str = PaneDirection::direction_from_str),
possible_values=PaneDirection::variants())]
direction: PaneDirection,
},
}