Skip to content

Commit

Permalink
If setup --clean is used, avoid loading from the user's theme
Browse files Browse the repository at this point in the history
directory.
  • Loading branch information
Imberflur committed Apr 28, 2023
1 parent 90badfb commit 11918ee
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions zellij-utils/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,16 @@ impl Setup {

config.themes = get_default_themes().merge(config.themes);

let user_theme_dir = config_options.theme_dir.clone().or_else(|| {
get_theme_dir(cli_args.config_dir.clone().or_else(find_default_config_dir))
// If theme dir is not explicitly specified in config_options,
// only try to use it if it exists.
.filter(|dir| dir.exists())
});
if let Some(user_theme_dir) = user_theme_dir {
config.themes = config.themes.merge(Themes::from_dir(user_theme_dir)?);
if let Some(Command::Setup(Setup { clean: false, .. })) = &cli_args.command {
let user_theme_dir = config_options.theme_dir.clone().or_else(|| {
get_theme_dir(cli_args.config_dir.clone().or_else(find_default_config_dir))
// If theme dir is not explicitly specified in config_options,
// only try to use it if it exists.
.filter(|dir| dir.exists())
});
if let Some(user_theme_dir) = user_theme_dir {
config.themes = config.themes.merge(Themes::from_dir(user_theme_dir)?);
}
}

if let Some(Command::Setup(ref setup)) = &cli_args.command {
Expand Down

0 comments on commit 11918ee

Please sign in to comment.