diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-02-13 09:34:21 +0100 |
---|---|---|
committer | Aram Drevekenin <aram@poor.dev> | 2023-02-13 09:34:21 +0100 |
commit | 84c3e9394bfb3c11ff395fa58aa2385aa55eb9ae (patch) | |
tree | 396ad5026913af3cfae18416633672f3713d6b5b /zellij-utils | |
parent | bd1e81222490b01eabece06c88f380cd9788e449 (diff) |
feat(cli): dump swap layouts
Diffstat (limited to 'zellij-utils')
-rw-r--r-- | zellij-utils/src/setup.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index 17c970b9f..2c4d89899 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -193,6 +193,18 @@ pub fn dump_specified_layout(layout: &str) -> std::io::Result<()> { } } +pub fn dump_specified_swap_layout(swap_layout: &str) -> std::io::Result<()> { + match swap_layout { + "strider" => dump_asset(STRIDER_SWAP_LAYOUT), + "default" => dump_asset(DEFAULT_SWAP_LAYOUT), + "compact" => dump_asset(COMPACT_BAR_SWAP_LAYOUT), + not_found => Err(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Swap Layout not found for: {}", not_found), + )), + } +} + #[cfg(not(target_family = "wasm"))] pub fn dump_builtin_plugins(path: &PathBuf) -> Result<()> { for (asset_path, bytes) in ASSET_MAP.iter() { @@ -248,6 +260,10 @@ pub struct Setup { #[clap(long, value_parser)] pub dump_layout: Option<String>, + /// Dump the specified swap layout file to stdout + #[clap(long, value_parser)] + pub dump_swap_layout: Option<String>, + /// Dump the builtin plugins to DIR or "DATA DIR" if unspecified #[clap( long, @@ -355,6 +371,11 @@ impl Setup { std::process::exit(0); } + if let Some(swap_layout) = &self.dump_swap_layout { + dump_specified_swap_layout(swap_layout)?; + std::process::exit(0); + } + Ok(()) } |