Skip to content

Commit 6c8de6a

Browse files
committed
Server(feat[command_prompt]): fill missing flag gaps
why: command-prompt has useful flags for single-key mode, keystroke callbacks, and prompt type selection that were not exposed. what: - Add one_key (-1), key_only (-k), on_input_change (-i), no_execute (-N), prompt_type (-T) parameters to command_prompt()
1 parent b28db9a commit 6c8de6a

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/libtmux/server.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,11 @@ def command_prompt(
893893
prompt: str | None = None,
894894
inputs: str | None = None,
895895
target_client: str | None = None,
896+
one_key: bool | None = None,
897+
key_only: bool | None = None,
898+
on_input_change: bool | None = None,
899+
no_execute: bool | None = None,
900+
prompt_type: str | None = None,
896901
) -> None:
897902
"""Open a command prompt via ``$ tmux command-prompt``.
898903
@@ -911,6 +916,17 @@ def command_prompt(
911916
Pre-fill prompt input (``-I`` flag). Commas separate multiple.
912917
target_client : str, optional
913918
Target client (``-t`` flag).
919+
one_key : bool, optional
920+
Accept only one key press (``-1`` flag).
921+
key_only : bool, optional
922+
Only accept key presses, not text (``-k`` flag).
923+
on_input_change : bool, optional
924+
Run template on each keystroke (``-i`` flag).
925+
no_execute : bool, optional
926+
Do not execute the command, just insert into prompt (``-N`` flag).
927+
prompt_type : str, optional
928+
Prompt type (``-T`` flag). One of: ``command``, ``search``,
929+
``target``, ``window-target``.
914930
915931
Examples
916932
--------
@@ -926,12 +942,27 @@ def command_prompt(
926942
"""
927943
tmux_args: tuple[str, ...] = ("-b",)
928944

945+
if one_key:
946+
tmux_args += ("-1",)
947+
948+
if key_only:
949+
tmux_args += ("-k",)
950+
951+
if on_input_change:
952+
tmux_args += ("-i",)
953+
954+
if no_execute:
955+
tmux_args += ("-N",)
956+
929957
if prompt is not None:
930958
tmux_args += ("-p", prompt)
931959

932960
if inputs is not None:
933961
tmux_args += ("-I", inputs)
934962

963+
if prompt_type is not None:
964+
tmux_args += ("-T", prompt_type)
965+
935966
if target_client is not None:
936967
tmux_args += ("-t", target_client)
937968

0 commit comments

Comments
 (0)