summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-07-03 15:45:14 +0100
committerEmīls <emils@mullvad.net>2020-07-03 15:45:14 +0100
commit636b49b01c8baf17c69f7412a298c8b260fcaa89 (patch)
treee09f15d40423377571d4516c9e426e7a7cde730f /mullvad-cli
parent8b7a6fe8c352f06c7ec9d85a309ae747419778e7 (diff)
parent8c8959ec5ecf5d422a1edfb05e245ab7e3f5e3a2 (diff)
downloadmullvadvpn-636b49b01c8baf17c69f7412a298c8b260fcaa89.tar.xz
mullvadvpn-636b49b01c8baf17c69f7412a298c8b260fcaa89.zip
Merge branch 'improve-postinstall'
Diffstat (limited to 'mullvad-cli')
-rw-r--r--mullvad-cli/src/cmds/account.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs
index 3baac8d192..e35699605c 100644
--- a/mullvad-cli/src/cmds/account.rs
+++ b/mullvad-cli/src/cmds/account.rs
@@ -31,6 +31,10 @@ impl Command for Account {
.about("Removes the account number from the settings"),
)
.subcommand(
+ clap::SubCommand::with_name("clear-history")
+ .about("Clear account history, along with removing all associated keys"),
+ )
+ .subcommand(
clap::SubCommand::with_name("create")
.about("Creates a new account and sets it as the active one"),
)
@@ -49,10 +53,12 @@ impl Command for Account {
if let Some(set_matches) = matches.subcommand_matches("set") {
let token = value_t_or_exit!(set_matches.value_of("token"), String);
self.set(Some(token))
- } else if let Some(_matches) = matches.subcommand_matches("unset") {
- self.set(None)
} else if let Some(_matches) = matches.subcommand_matches("get") {
self.get()
+ } else if let Some(_matches) = matches.subcommand_matches("unset") {
+ self.set(None)
+ } else if let Some(_matches) = matches.subcommand_matches("clear-history") {
+ self.clear_history()
} else if let Some(_matches) = matches.subcommand_matches("create") {
self.create()
} else if let Some(matches) = matches.subcommand_matches("redeem") {
@@ -138,4 +144,11 @@ impl Account {
_ => 0,
}
}
+
+ fn clear_history(&self) -> Result<()> {
+ let mut rpc = new_rpc_client()?;
+ rpc.clear_account_history()?;
+ println!("Removed account history and all associated keys");
+ Ok(())
+ }
}