winbrew_database\config/
storage.rs1use super::types::{Config, ConfigSection};
2use anyhow::Result;
3
4pub fn config_set(key: &str, value: &str) -> Result<()> {
5 let mut config = Config::load_current()?;
6
7 config.set_value(key, value)?;
8 config.save_default()?;
9 Ok(())
10}
11
12pub fn config_unset(key: &str) -> Result<()> {
13 let mut config = Config::load_current()?;
14
15 config.unset_value(key)?;
16 config.save_default()?;
17 Ok(())
18}
19
20pub fn config_sections() -> Result<Vec<ConfigSection>> {
21 Config::load_current()?.effective_sections()
22}
23
24pub fn get_effective_value(key: &str) -> Result<(String, super::types::ConfigSource)> {
25 Ok(Config::load_current()?.effective_value(key)?)
26}