aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-07-08 22:50:08 +0200
committerGitHub <noreply@github.com>2025-07-08 22:50:08 +0200
commitda9cf4ffeb1659669b067165ba6718556d665f2b (patch)
treeef4404d5b82117baf8249a7bcc7efd0a7af31794 /zellij-utils/src/input
parentfix(tabs): allow setting cwd without a layout (#4273) (diff)
downloadsl0ppij-da9cf4ffeb1659669b067165ba6718556d665f2b.tar.gz
sl0ppij-da9cf4ffeb1659669b067165ba6718556d665f2b.tar.xz
sl0ppij-da9cf4ffeb1659669b067165ba6718556d665f2b.zip
fix(serialization): don't serialize when only UI elements present and provide post command discovery hook (#4276)
* do not serialize when only UI elements are present * start work on a post serialization hook * add post_command_discovery_hook * fix tests * style(fmt): rustfmt * some cleanups * moar formatting * docs(changelog): add PR
Diffstat (limited to 'zellij-utils/src/input')
-rw-r--r--zellij-utils/src/input/options.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/zellij-utils/src/input/options.rs b/zellij-utils/src/input/options.rs
index 3e167022..72b4e63b 100644
--- a/zellij-utils/src/input/options.rs
+++ b/zellij-utils/src/input/options.rs
@@ -227,6 +227,10 @@ pub struct Options {
pub web_server_cert: Option<PathBuf>,
pub web_server_key: Option<PathBuf>,
pub enforce_https_for_localhost: Option<bool>,
+ /// A command to run after the discovery of running commands when serializing, for the purpose
+ /// of manipulating the command (eg. with a regex) before it gets serialized
+ #[clap(long, value_parser)]
+ pub post_command_discovery_hook: Option<String>,
}
#[derive(ArgEnum, Deserialize, Serialize, Debug, Clone, Copy, PartialEq)]
@@ -320,6 +324,9 @@ impl Options {
let enforce_https_for_localhost = other
.enforce_https_for_localhost
.or(self.enforce_https_for_localhost);
+ let post_command_discovery_hook = other
+ .post_command_discovery_hook
+ .or(self.post_command_discovery_hook.clone());
Options {
simplified_ui,
@@ -360,6 +367,7 @@ impl Options {
web_server_cert,
web_server_key,
enforce_https_for_localhost,
+ post_command_discovery_hook,
}
}
@@ -433,6 +441,9 @@ impl Options {
let enforce_https_for_localhost = other
.enforce_https_for_localhost
.or(self.enforce_https_for_localhost);
+ let post_command_discovery_hook = other
+ .post_command_discovery_hook
+ .or_else(|| self.post_command_discovery_hook.clone());
Options {
simplified_ui,
@@ -473,6 +484,7 @@ impl Options {
web_server_cert,
web_server_key,
enforce_https_for_localhost,
+ post_command_discovery_hook,
}
}
@@ -549,6 +561,7 @@ impl From<CliOptions> for Options {
web_server_cert: opts.web_server_cert,
web_server_key: opts.web_server_key,
enforce_https_for_localhost: opts.enforce_https_for_localhost,
+ post_command_discovery_hook: opts.post_command_discovery_hook,
..Default::default()
}
}