diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-02-28 15:47:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 15:47:08 +0100 |
commit | 9dc3cb19616ece5e363a357fc06e0e75ac8b49e0 (patch) | |
tree | 9e4a287ecc35758cf5568bdc42e55292cb830fea /zellij-utils | |
parent | b3b0ddbab82ab74c02dbc991b24f4a3c88f2bcbe (diff) |
fix(new-tab): get config parameters from config file (#2203)
* fix(cli): take default shell from config if it exists when opening new tab
* fix(cli): take layout dir from config when opening new tab if it exists
* style(fmt): rustfmt
Diffstat (limited to 'zellij-utils')
-rw-r--r-- | zellij-utils/src/input/actions.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index a47e79f47..7b7f78c43 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -7,7 +7,7 @@ use super::layout::{ use crate::cli::CliAction; use crate::data::InputMode; use crate::data::{Direction, Resize}; -use crate::input::config::{ConfigError, KdlError}; +use crate::input::config::{Config, ConfigError, KdlError}; use crate::input::options::OnForceClose; use crate::setup::{find_default_config_dir, get_layout_dir}; use miette::{NamedSource, Report}; @@ -237,6 +237,7 @@ impl Action { pub fn actions_from_cli( cli_action: CliAction, get_current_dir: Box<dyn Fn() -> PathBuf>, + config: Option<Config>, ) -> Result<Vec<Action>, String> { match cli_action { CliAction::Write { bytes } => Ok(vec![Action::Write(bytes)]), @@ -367,8 +368,9 @@ impl Action { .map(|cwd| current_dir.join(cwd)) .or_else(|| Some(current_dir)); if let Some(layout_path) = layout { - let layout_dir = - layout_dir.or_else(|| get_layout_dir(find_default_config_dir())); + let layout_dir = layout_dir + .or_else(|| config.and_then(|c| c.options.layout_dir)) + .or_else(|| get_layout_dir(find_default_config_dir())); let (path_to_raw_layout, raw_layout, swap_layouts) = Layout::stringified_from_path_or_default(Some(&layout_path), layout_dir) .map_err(|e| format!("Failed to load layout: {}", e))?; |