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

Use default style if user-defined style is missing. #210

Merged
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
20 changes: 14 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,29 @@ impl Default for RawDirectoriesConfig {
}
}

#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
struct RawConfig {
#[serde(default)]
style: RawStyleConfig,
#[serde(default)]
display: RawDisplayConfig,
#[serde(default)]
updates: RawUpdatesConfig,
#[serde(default)]
directories: RawDirectoriesConfig,
}

impl RawConfig {
fn new() -> Self {
let mut raw_config = Self::default();
Self::default()
}
}

impl Default for RawConfig {
fn default() -> Self {
let mut raw_config = RawConfig {
style: RawStyleConfig::default(),
display: RawDisplayConfig::default(),
updates: RawUpdatesConfig::default(),
directories: RawDirectoriesConfig::default(),
};

// Set default config
raw_config.style.example_text.foreground = Some(RawColor::Green);
Expand Down