diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-12-11 14:25:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-11 14:25:42 +0100 |
| commit | 693fa082def5ef0fe030cd7fdc3b1df051b35dc6 (patch) | |
| tree | b3f651462bbc1cd2fa5b2d79207343413ef6b83c /zellij-utils/src/cli.rs | |
| parent | fix(zellij-server): unblock building on 32bit targets (#4484) (diff) | |
| download | sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.gz sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.xz sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.zip | |
Command Sequences, Blocking CLI Commands, New Plugin APIs (#4546)
* fix deadlocks
* initial logging to plugin implementation
* only log actions, include keys as Action::Write
* send actions to plugins as a new Event::UserAction
* add Action::Write metadata to plugin API
* run_action plugin command and permission
* block-until-exit/success/failure in the cli
* fix tests
* add NewBlockingPane to the plugin API
* run actions in a different thread so as not to block plugin execution
* add custom context to run_action flow
* fixes for floating pane z_index sorting and unknown protobuf events not crashing plugins
* always render the frame of pinned panes
* macros module
* add macros to config
* KDL macro parsing
* thread macros to the plugin thread
* get/update/delete macros from plugins
* add macros updated event
* add ability to rename macros
* fix deadlock
* fix z_indices with pinned unselectable panes bug
* allow plugins to opt-in to show_cursor
* change show_cursor(bool) to show_cursor(Option<coordinates>)
* test
* upgrade strum to allow proper enum iteration and case insensitive fromstr implementation for Actions
* better cwd tracking for exited command panes
* add initial panes to NewTab Action (no-op for now)
* add initial panes to cli newtab action
* make initial panes work
* add close_on_exit and start_suspended to the cli
* properly convert newtab action (potentially breaking for plugins)
* allow first pane in tab to block
* make distinction between opening panes with the last active client and the current pane in the cli
* improve some apis
* fix fixed size closing pane bug
* fix plugin cursor coordinates
* fix issues with launch-or-focus-plugin having to do with in-place and suppressed panes
* fix: set affected pane in replace pane
* allow setting a pane in place when it is suppressed and being focused (tests failing)
* fix tests
* some fixes for unsuppression of panes
* some fixes for completion_tx in new tab action
* allow replace/suppressed rather than replace/close only
* fixes for inserting suppressed panes without conflicts
* pane focus history and explicit unsuppress plugin api
* fix: prefer explicitly provided pane id in placement in actions that provide it
* fix floating pane coordinate change and z_index
* fix plugin cache dir to persist between sessions
* fix some stack focusing issues when adding panes without a client id
* make sure pinned panes are always above non-pinned floating panes
* allow plugins to copy to clipboard
* initial text styling additions implementations - buggy
* fix dimming issues
* remove extras, stay with just dim and unbold
* unbold and dim as indices
* allow ui components to render success/error colors
* allow plugins to send sigint/sigkill to processes, as well as receive their pid
* ui component fixes and send originating plugin context with run_action
* originating plugin for new tab too
* make plugn show pane command also expand stacked panes
* add sequence plugin
* remove macros
* remove snapshots
* add shortcut for sequence plugin
* fix plugin tests
* plugin tests for new apis
* update snapshots for sequence shortcut
* cleanups and formatting
* Event::CwdChanged
* moar cleanups
* remove some warnings
* remove mroe warnings
* remove dead code
* remove more dead code
* fix minor bugs in sequence plugin
* update sequence help and format codebase
* fix conditional blocking cli commands
* fix initial-command new-tab cli flag
* add client_ids to CwdChanged Event
* last fixes
* add pr
Diffstat (limited to 'zellij-utils/src/cli.rs')
| -rw-r--r-- | zellij-utils/src/cli.rs | 128 |
1 files changed, 126 insertions, 2 deletions
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index 0fd52473..e59ba71f 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -1,4 +1,4 @@ -use crate::data::{Direction, InputMode, Resize}; +use crate::data::{Direction, InputMode, Resize, UnblockCondition}; use crate::setup::Setup; use crate::{ consts::{ZELLIJ_CONFIG_DIR_ENV, ZELLIJ_CONFIG_FILE_ENV}, @@ -388,9 +388,49 @@ pub enum Sessions { takes_value(false) )] stacked: bool, - /// Whether to block until this command has finished + /// Block until the command has finished and its pane has been closed #[clap(long, value_parser, default_value("false"), takes_value(false))] blocking: bool, + + /// Block until the command exits successfully (exit status 0) OR its pane has been closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + conflicts_with("blocking"), + conflicts_with("block-until-exit-failure"), + conflicts_with("block-until-exit") + )] + block_until_exit_success: bool, + + /// Block until the command exits with failure (non-zero exit status) OR its pane has been + /// closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + conflicts_with("blocking"), + conflicts_with("block-until-exit-success"), + conflicts_with("block-until-exit") + )] + block_until_exit_failure: bool, + + /// Block until the command exits (regardless of exit status) OR its pane has been closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + conflicts_with("blocking"), + conflicts_with("block-until-exit-success"), + conflicts_with("block-until-exit-failure") + )] + block_until_exit: bool, + /// if set, will open the pane near the current one rather than following the user's focus + #[clap(long)] + near_current_pane: bool, }, /// Load a plugin #[clap(visible_alias = "p")] @@ -484,6 +524,9 @@ pub enum Sessions { /// Whether to pin a floating pane so that it is always on top #[clap(long, requires("floating"))] pinned: Option<bool>, + /// if set, will open the pane near the current one rather than following the user's focus + #[clap(long)] + near_current_pane: bool, }, ConvertConfig { old_config_file: PathBuf, @@ -691,6 +734,14 @@ pub enum CliAction { stacked: bool, #[clap(short, long)] blocking: bool, + + // TODO: clean this up + #[clap(skip)] + unblock_condition: Option<UnblockCondition>, + + /// if set, will open the pane near the current one rather than following the user's focus + #[clap(long)] + near_current_pane: bool, }, /// Open the specified file in a new zellij pane with your default EDITOR Edit { @@ -738,6 +789,9 @@ pub enum CliAction { /// Whether to pin a floating pane so that it is always on top #[clap(long, requires("floating"))] pinned: Option<bool>, + /// if set, will open the pane near the current one rather than following the user's focus + #[clap(long)] + near_current_pane: bool, }, /// Switch input mode of all connected clients [locked|pane|tab|resize|move|search|session] SwitchMode { @@ -795,6 +849,76 @@ pub enum CliAction { /// Change the working directory of the new tab #[clap(short, long, value_parser)] cwd: Option<PathBuf>, + + /// Optional initial command to run in the new tab + #[clap( + value_parser, + conflicts_with("initial-plugin"), + multiple_values(true), + takes_value(true), + last(true) + )] + initial_command: Vec<String>, + + /// Initial plugin to load in the new tab + #[clap(long, value_parser, conflicts_with("initial-command"))] + initial_plugin: Option<String>, + + /// Close the pane immediately when its command exits + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + requires("initial-command") + )] + close_on_exit: bool, + + /// Start the command suspended, only running it after you first press ENTER + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + requires("initial-command") + )] + start_suspended: bool, + + /// Block until the command exits successfully (exit status 0) OR its pane has been closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + requires("initial-command"), + conflicts_with("block-until-exit-failure"), + conflicts_with("block-until-exit") + )] + block_until_exit_success: bool, + + /// Block until the command exits with failure (non-zero exit status) OR its pane has been closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + requires("initial-command"), + conflicts_with("block-until-exit-success"), + conflicts_with("block-until-exit") + )] + block_until_exit_failure: bool, + + /// Block until the command exits (regardless of exit status) OR its pane has been closed + #[clap( + long, + value_parser, + default_value("false"), + takes_value(false), + requires("initial-command"), + conflicts_with("block-until-exit-success"), + conflicts_with("block-until-exit-failure") + )] + block_until_exit: bool, }, /// Move the focused tab in the specified direction. [right|left] MoveTab { |
