diff options
Diffstat (limited to 'src/bin/rbw/commands.rs')
-rw-r--r-- | src/bin/rbw/commands.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index a6e98c7..a2e9f9d 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -75,6 +75,23 @@ pub fn config_set(key: &str, value: &str) -> anyhow::Result<()> { Ok(()) } +pub fn config_unset(key: &str) -> anyhow::Result<()> { + let mut config = rbw::config::Config::load() + .unwrap_or_else(|_| rbw::config::Config::new()); + match key { + "email" => config.email = None, + "base_url" => config.base_url = None, + "identity_url" => config.identity_url = None, + "lock_timeout" => { + config.lock_timeout = rbw::config::default_lock_timeout() + } + _ => return Err(anyhow::anyhow!("invalid config key: {}", key)), + } + config.save().context("failed to save config file")?; + + Ok(()) +} + pub fn login() -> anyhow::Result<()> { ensure_agent()?; crate::actions::login()?; |