aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/setup.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-05-15 11:20:36 +0200
committerGitHub <noreply@github.com>2024-05-15 11:20:36 +0200
commit90a62217fdd033fb2dd99b6f2ee3a945ae6b9baa (patch)
treeb0c701b1956b3eee058cfc2cd2674e74503478d3 /zellij-utils/src/setup.rs
parentchore(version): bump development version (diff)
downloadsl0ppij-90a62217fdd033fb2dd99b6f2ee3a945ae6b9baa.tar.gz
sl0ppij-90a62217fdd033fb2dd99b6f2ee3a945ae6b9baa.tar.xz
sl0ppij-90a62217fdd033fb2dd99b6f2ee3a945ae6b9baa.zip
feat(layouts): allow consuming a layout from a url (#3351)
* feat(cli): allow loading layouts directly from a url * feat(plugins): allow loading layouts directly from a url * style(fmt): rustfmt
Diffstat (limited to '')
-rw-r--r--zellij-utils/src/setup.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs
index e41a2061..780530d7 100644
--- a/zellij-utils/src/setup.rs
+++ b/zellij-utils/src/setup.rs
@@ -671,9 +671,23 @@ impl Setup {
.and_then(|cli_options| cli_options.default_layout.clone())
})
.or_else(|| config.options.default_layout.clone());
- // we merge-override the config here because the layout might contain configuration
- // that needs to take precedence
- Layout::from_path_or_default(chosen_layout.as_ref(), layout_dir.clone(), config)
+ if let Some(layout_url) = chosen_layout
+ .as_ref()
+ .and_then(|l| l.to_str())
+ .and_then(|l| {
+ if l.starts_with("http://") || l.starts_with("https://") {
+ Some(l)
+ } else {
+ None
+ }
+ })
+ {
+ Layout::from_url(layout_url, config)
+ } else {
+ // we merge-override the config here because the layout might contain configuration
+ // that needs to take precedence
+ Layout::from_path_or_default(chosen_layout.as_ref(), layout_dir.clone(), config)
+ }
}
fn handle_setup_commands(cli_args: &CliArgs) {
if let Some(Command::Setup(ref setup)) = &cli_args.command {