summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2023-08-07 11:53:46 +0200
committerDavid Lönnhager <david.l@mullvad.net>2023-08-21 17:02:26 +0200
commitecc40cc4413ff7df123f392599bf5c5c5b2b6a22 (patch)
tree22931b5aeac958b90d94fedbde6bb5606e93ea82 /mullvad-cli/src/cmds
parenta64c0156af2a7b24e0c6313b8edac877baada3cf (diff)
downloadmullvadvpn-ecc40cc4413ff7df123f392599bf5c5c5b2b6a22.tar.xz
mullvadvpn-ecc40cc4413ff7df123f392599bf5c5c5b2b6a22.zip
Do not print redundant custom list name
If the user wants to print a single list using `mullvad custom-list list <name>`, the name of the list does not need to be part of the pretty print.
Diffstat (limited to 'mullvad-cli/src/cmds')
-rw-r--r--mullvad-cli/src/cmds/custom_lists.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/mullvad-cli/src/cmds/custom_lists.rs b/mullvad-cli/src/cmds/custom_lists.rs
index 441032a381..a509dfc5bf 100644
--- a/mullvad-cli/src/cmds/custom_lists.rs
+++ b/mullvad-cli/src/cmds/custom_lists.rs
@@ -82,7 +82,7 @@ impl CustomList {
async fn list() -> Result<()> {
let mut rpc = MullvadProxyClient::new().await?;
for custom_list in rpc.list_custom_lists().await? {
- Self::print_custom_list(&custom_list);
+ Self::print_custom_list(&custom_list)
}
Ok(())
}
@@ -92,7 +92,7 @@ impl CustomList {
async fn get(name: String) -> Result<()> {
let mut rpc = MullvadProxyClient::new().await?;
let custom_list = rpc.get_custom_list(name).await?;
- Self::print_custom_list(&custom_list);
+ Self::print_custom_list_content(&custom_list);
Ok(())
}
@@ -132,8 +132,12 @@ impl CustomList {
fn print_custom_list(custom_list: &mullvad_types::custom_list::CustomList) {
println!("{}", custom_list.name);
+ Self::print_custom_list_content(&custom_list);
+ }
+
+ fn print_custom_list_content(custom_list: &mullvad_types::custom_list::CustomList) {
for location in &custom_list.locations {
- println!("\t{}", location);
+ println!("\t{location}");
}
}
}