diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-05-15 11:20:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-15 11:20:36 +0200 |
| commit | 90a62217fdd033fb2dd99b6f2ee3a945ae6b9baa (patch) | |
| tree | b0c701b1956b3eee058cfc2cd2674e74503478d3 /zellij-utils/src/setup.rs | |
| parent | chore(version): bump development version (diff) | |
| download | sl0ppij-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.rs | 20 |
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 { |
