Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve setup --clean panic #1882

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions zellij-utils/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions zellij-utils/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Options> =
if let Some(Command::Options(options)) = cli_args.command.clone() {
Some(options.into())
Expand Down