fix(config): better handling of default values (#123)

This commit is contained in:
Alexandre Pasmantier 2024-12-15 01:09:53 +01:00 committed by GitHub
parent 37b2dda729
commit 7b114b7cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View File

@ -44,16 +44,15 @@ input_bar_position = "bottom"
# A list of builtin themes can be found in the `themes` directory of the television
# repository. You may also create your own theme by creating a new file in a `themes`
# directory in your configuration directory (see the `config.toml` location above).
theme = "gruvbox-dark"
theme = "catppuccin-mocha"
# Previewers settings
# ----------------------------------------------------------------------------
[previewers.file]
# The theme to use for syntax highlighting
# A list of available themes can be found in the https://github.com/sharkdp/bat
# repository which uses the same syntax highlighting engine as television
# You may add your own themes by following the instructions in the bat repository
theme = "gruvbox-dark"
# The theme to use for syntax highlighting.
# Bulitin syntax highlighting uses the same syntax highlighting engine as bat.
# To get a list of your currently available themes, run `bat --list-themes`
theme = "Coldark-Dark"
# Keybindings
# ----------------------------------------------------------------------------

View File

@ -79,8 +79,8 @@ impl Config {
let mut builder = config::Config::builder()
.set_default("data_dir", data_dir.to_str().unwrap())?
.set_default("config_dir", config_dir.to_str().unwrap())?
.set_default("ui", UiConfig::default())?
.set_default("previewers", PreviewersConfig::default())?
.set_default("ui", default_config.ui.clone())?
.set_default("previewers", default_config.previewers.clone())?
.set_default("theme", default_config.ui.theme.clone())?;
// Load the user's config file