Browse Source

Flatten main config fields into root config

David Peter 2 years ago
parent
commit
effe5962c5
2 changed files with 5 additions and 1 deletions
  1. 0 1
      book/src/cli-customization.md
  2. 5 0
      numbat-cli/src/config.rs

+ 0 - 1
book/src/cli-customization.md

@@ -48,7 +48,6 @@ numbat --generate-config
 The most important fields are:
 
 ``` toml
-[main]
 # Controls the welcome message. Can be "long", "short", or "off".
 intro-banner = "long"
 

+ 5 - 0
numbat-cli/src/config.rs

@@ -24,7 +24,11 @@ pub struct MainConfig {
     pub intro_banner: IntroBanner,
     pub prompt: String,
     pub pretty_print: PrettyPrintMode,
+
+    #[serde(skip_serializing)]
     pub load_prelude: bool,
+
+    #[serde(skip_serializing)]
     pub load_user_init: bool,
 }
 
@@ -71,6 +75,7 @@ impl Default for ExchangeRateConfig {
 #[derive(Default, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
 pub struct Config {
+    #[serde(flatten)]
     pub main: MainConfig,
     pub exchange_rates: ExchangeRateConfig,
 }