summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-07-02 22:49:29 +0100
committerEmīls <emils@mullvad.net>2020-07-03 15:11:25 +0100
commit48240f36657799c46e7db16edbc47771e9d44403 (patch)
tree256be74d1c7dca145b34fb856f1c045c58b2fe3b /mullvad-cli/src
parente9d8f92059650d717e8871176ead70ef49092a9d (diff)
downloadmullvadvpn-48240f36657799c46e7db16edbc47771e9d44403.tar.xz
mullvadvpn-48240f36657799c46e7db16edbc47771e9d44403.zip
Add RPC to clear account history
Diffstat (limited to 'mullvad-cli/src')
-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(())
+ }
}