summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/cli.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-02-08 17:35:55 +0100
committerGitHub <noreply@github.com>2024-02-08 17:35:55 +0100
commit326c8cd3c6566e8fa4acd3a9369c718ce96f6625 (patch)
tree805ded9e78a35e9cd1ae91594358c8888a53abe2 /zellij-utils/src/cli.rs
parent662c37b5083e2c31d6227645ff5a27ad5d5ceb41 (diff)
feat(panes): allow specifying coordinates for a new floating pane through the CLI or plugins (#3122)
* working * add tests * add coordinates to all the places * refactor: move things around: * style(fmt): rustfmt * style(code): cleanups
Diffstat (limited to 'zellij-utils/src/cli.rs')
-rw-r--r--zellij-utils/src/cli.rs63
1 files changed, 62 insertions, 1 deletions
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index bf8f8880d..595293f4e 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -216,6 +216,19 @@ pub enum Sessions {
/// Start the command suspended, only running after you first presses ENTER
#[clap(short, long, value_parser, default_value("false"), takes_value(false))]
start_suspended: bool,
+
+ /// The x coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ x: Option<String>,
+ /// The y coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ y: Option<String>,
+ /// The width if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ width: Option<String>,
+ /// The height if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ height: Option<String>,
},
/// Load a plugin
#[clap(visible_alias = "r")]
@@ -246,6 +259,18 @@ pub enum Sessions {
/// Skip the memory and HD cache and force recompile of the plugin (good for development)
#[clap(short, long, value_parser, default_value("false"), takes_value(false))]
skip_plugin_cache: bool,
+ /// The x coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ x: Option<String>,
+ /// The y coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ y: Option<String>,
+ /// The width if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ width: Option<String>,
+ /// The height if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ height: Option<String>,
},
/// Edit file with default $EDITOR / $VISUAL
#[clap(visible_alias = "e")]
@@ -279,6 +304,18 @@ pub enum Sessions {
/// Change the working directory of the editor
#[clap(long, value_parser)]
cwd: Option<PathBuf>,
+ /// The x coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ x: Option<String>,
+ /// The y coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ y: Option<String>,
+ /// The width if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ width: Option<String>,
+ /// The height if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ height: Option<String>,
},
ConvertConfig {
old_config_file: PathBuf,
@@ -458,8 +495,20 @@ pub enum CliAction {
start_suspended: bool,
#[clap(long, value_parser)]
configuration: Option<PluginUserConfiguration>,
- #[clap(short, long, value_parser)]
+ #[clap(long, value_parser)]
skip_plugin_cache: bool,
+ /// The x coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ x: Option<String>,
+ /// The y coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ y: Option<String>,
+ /// The width if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ width: Option<String>,
+ /// The height if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ height: Option<String>,
},
/// Open the specified file in a new zellij pane with your default EDITOR
Edit {
@@ -492,6 +541,18 @@ pub enum CliAction {
/// Change the working directory of the editor
#[clap(long, value_parser)]
cwd: Option<PathBuf>,
+ /// The x coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ x: Option<String>,
+ /// The y coordinates if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(short, long, requires("floating"))]
+ y: Option<String>,
+ /// The width if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ width: Option<String>,
+ /// The height if the pane is floating as a bare integer (eg. 1) or percent (eg. 10%)
+ #[clap(long, requires("floating"))]
+ height: Option<String>,
},
/// Switch input mode of all connected clients [locked|pane|tab|resize|move|search|session]
SwitchMode {