aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/cli.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-03-30 16:02:09 +0200
committerGitHub <noreply@github.com>2026-03-30 16:02:09 +0200
commit8ce05f0bbd58acbbca95f95ae14fdc4e866f7391 (patch)
tree57c6d9ee2231a556f938df4f2629511a711518df /zellij-utils/src/cli.rs
parentdocs(changelog): recent windows fixes (diff)
downloadsl0ppij-8ce05f0bbd58acbbca95f95ae14fdc4e866f7391.tar.gz
sl0ppij-8ce05f0bbd58acbbca95f95ae14fdc4e866f7391.tar.xz
sl0ppij-8ce05f0bbd58acbbca95f95ae14fdc4e866f7391.zip
Layout string flag (#4956)
* allow sending a stringified layout with --layout-string * add --tab-id to all the things * fix windows tests * add pr
Diffstat (limited to 'zellij-utils/src/cli.rs')
-rw-r--r--zellij-utils/src/cli.rs70
1 files changed, 66 insertions, 4 deletions
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index 12117265..f02ace98 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -59,6 +59,12 @@ pub struct CliArgs {
#[clap(short, long, value_parser, overrides_with = "layout")]
pub layout: Option<PathBuf>,
+ /// Raw KDL layout string to use directly (instead of a file path)
+ /// if inside a session (or using the --session flag) will be added to the session as a new tab
+ /// or tabs, otherwise will start a new session
+ #[clap(long, value_parser, conflicts_with_all = &["layout", "new-session-with-layout"])]
+ pub layout_string: Option<String>,
+
/// Name of a predefined layout inside the layout directory or the path to a layout file
/// Will always start a new session, even if inside an existing session
#[clap(short, long, value_parser, overrides_with = "new_session_with_layout")]
@@ -515,6 +521,14 @@ pub enum Sessions {
/// mouse)
#[clap(short, long, value_parser)]
borderless: Option<bool>,
+ /// Target a specific tab by ID
+ #[clap(
+ long,
+ value_parser,
+ conflicts_with("near-current-pane"),
+ conflicts_with("in-place")
+ )]
+ tab_id: Option<usize>,
},
/// Load a plugin
/// Returns: Created pane ID (format: plugin_<id>)
@@ -575,6 +589,9 @@ pub enum Sessions {
/// mouse)
#[clap(short, long, value_parser)]
borderless: Option<bool>,
+ /// Target a specific tab by ID
+ #[clap(long, value_parser, conflicts_with("in-place"))]
+ tab_id: Option<usize>,
},
/// Edit file with default $EDITOR / $VISUAL
/// Returns: Created pane ID (format: terminal_<id>)
@@ -641,6 +658,14 @@ pub enum Sessions {
/// mouse)
#[clap(short, long, value_parser)]
borderless: Option<bool>,
+ /// Target a specific tab by ID
+ #[clap(
+ long,
+ value_parser,
+ conflicts_with("near-current-pane"),
+ conflicts_with("in-place")
+ )]
+ tab_id: Option<usize>,
},
ConvertConfig {
old_config_file: PathBuf,
@@ -1010,6 +1035,14 @@ pub enum CliAction {
/// mouse)
#[clap(long, value_parser)]
borderless: Option<bool>,
+ /// Target a specific tab by ID
+ #[clap(
+ long,
+ value_parser,
+ conflicts_with("near-current-pane"),
+ conflicts_with("in-place")
+ )]
+ tab_id: Option<usize>,
},
/// Open the specified file in a new zellij pane with your default EDITOR
/// Returns: Created pane ID (format: terminal_<id>)
@@ -1075,6 +1108,14 @@ pub enum CliAction {
/// mouse)
#[clap(short, long, value_parser)]
borderless: Option<bool>,
+ /// Target a specific tab by ID
+ #[clap(
+ long,
+ value_parser,
+ conflicts_with("near-current-pane"),
+ conflicts_with("in-place")
+ )]
+ tab_id: Option<usize>,
},
/// Switch input mode of all connected clients [locked|pane|tab|resize|move|search|session]
SwitchMode {
@@ -1187,9 +1228,13 @@ pub enum CliAction {
/// Returns: The created tab's ID as a single number on stdout
NewTab {
/// Layout to use for the new tab
- #[clap(short, long, value_parser)]
+ #[clap(short, long, value_parser, conflicts_with = "layout-string")]
layout: Option<PathBuf>,
+ /// Raw KDL layout string to use directly (instead of a layout file path)
+ #[clap(long, value_parser, conflicts_with = "layout")]
+ layout_string: Option<String>,
+
/// Default folder to look for layouts
#[clap(long, value_parser, requires("layout"))]
layout_dir: Option<PathBuf>,
@@ -1292,8 +1337,16 @@ pub enum CliAction {
/// Override the layout of the active tab
OverrideLayout {
/// Path to the layout file
- #[clap(value_parser)]
- layout: PathBuf,
+ #[clap(
+ value_parser,
+ required_unless_present = "layout-string",
+ conflicts_with = "layout-string"
+ )]
+ layout: Option<PathBuf>,
+
+ /// Raw KDL layout string to use directly (instead of a layout file path)
+ #[clap(long, value_parser, conflicts_with = "layout")]
+ layout_string: Option<String>,
/// Default folder to look for layouts
#[clap(long, value_parser)]
@@ -1341,6 +1394,9 @@ pub enum CliAction {
configuration: Option<PluginUserConfiguration>,
#[clap(short, long, value_parser)]
skip_plugin_cache: bool,
+ /// Target a specific tab by ID
+ #[clap(long, value_parser, conflicts_with("in-place"))]
+ tab_id: Option<usize>,
},
/// Returns: Plugin pane ID (format: plugin_<id>)
LaunchPlugin {
@@ -1362,6 +1418,9 @@ pub enum CliAction {
configuration: Option<PluginUserConfiguration>,
#[clap(short, long, value_parser)]
skip_plugin_cache: bool,
+ /// Target a specific tab by ID
+ #[clap(long, value_parser, conflicts_with("in-place"))]
+ tab_id: Option<usize>,
},
RenameSession {
name: String,
@@ -1573,8 +1632,11 @@ tail -f /tmp/my-live-logfile | zellij action pipe --name logs --plugin https://e
#[clap(long)]
pane_id: Option<String>,
/// Layout to apply when switching to the session (relative paths start at layout-dir)
- #[clap(short, long, value_parser)]
+ #[clap(short, long, value_parser, conflicts_with = "layout-string")]
layout: Option<PathBuf>,
+ /// Raw KDL layout string to use directly
+ #[clap(long, value_parser, conflicts_with = "layout")]
+ layout_string: Option<String>,
/// Default folder to look for layouts
#[clap(long, value_parser, requires("layout"))]
layout_dir: Option<PathBuf>,