Produce human readable output in list

This commit is contained in:
Andrey Golovizin 2021-06-27 13:20:51 +02:00
parent fc0b55a207
commit 0d00d1fb74

View file

@ -85,7 +85,16 @@ fn list(opts: &ListOpts) -> Result<(), anyhow::Error> {
if opts.json {
println!("{}", serde_json::to_string(&locations)?);
} else {
println!("{:?}", &locations);
for (i, location) in locations.locations.iter().enumerate() {
if i > 0 {
println!()
};
println!("Name: {}", location.name);
println!("City: {}", location.city);
println!("Country: {}", location.country);
println!("Country code: {}", location.iso);
println!("WireGuard endpoint: {}", location.endpoints.wireguard);
}
}
Ok(())
}