From 3fc92b63617488b0726d045939f7f162717e7380 Mon Sep 17 00:00:00 2001 From: Thomas Linford Date: Sun, 30 Oct 2022 20:57:00 +0100 Subject: [PATCH] fix: do not use Config::default default() has empty plugins and does not work with default layout. Use Config::try_from() instead, since it already handles the clean flag. Do not check clean flag twice. --- zellij-utils/src/cli.rs | 9 --------- zellij-utils/src/setup.rs | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index 6f0ac59a73..f860f05f9b 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -48,15 +48,6 @@ pub struct CliArgs { pub debug: bool, } -impl CliArgs { - pub fn should_clean_config(&self) -> bool { - match &self.command { - Some(Command::Setup(ref setup)) => setup.clean, - _ => false, - } - } -} - #[derive(Debug, Subcommand, Clone, Serialize, Deserialize)] pub enum Command { /// Change the behaviour of zellij diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index c105c929ee..64d48114b1 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -211,14 +211,9 @@ impl Setup { /// (`layout.yaml` / `zellij --layout`) /// 3. config options (`config.yaml`) pub fn from_cli_args(cli_args: &CliArgs) -> Result<(Config, Layout, Options), ConfigError> { - let clean = cli_args.should_clean_config(); // note that this can potentially exit the process Setup::handle_setup_commands(cli_args); - let config = if clean { - Config::default() - } else { - Config::try_from(cli_args)? - }; + let config = Config::try_from(cli_args)?; let cli_config_options: Option = if let Some(Command::Options(options)) = cli_args.command.clone() { Some(options.into())