src/bin/proxmox-backup-client.rs - status: only print result[data]

This commit is contained in:
Dietmar Maurer 2019-07-18 09:52:11 +02:00
parent 15c847f136
commit f6ede796ca
2 changed files with 4 additions and 4 deletions

View File

@ -285,7 +285,7 @@ fn list_backup_groups(
} }
} }
if output_format != "text" { format_and_print_result(result.into(), &output_format); } if output_format != "text" { format_and_print_result(&(result.into()), &output_format); }
Ok(Value::Null) Ok(Value::Null)
} }
@ -344,7 +344,7 @@ fn list_snapshots(
} }
} }
if output_format != "text" { format_and_print_result(result.into(), &output_format); } if output_format != "text" { format_and_print_result(&result.into(), &output_format); }
Ok(Value::Null) Ok(Value::Null)
} }
@ -796,7 +796,7 @@ fn status(
avail, avail,
); );
} else { } else {
format_and_print_result(result, &output_format); format_and_print_result(data, &output_format);
} }
Ok(Value::Null) Ok(Value::Null)

View File

@ -27,7 +27,7 @@ lazy_static!{
/// This is implemented for machine generatable formats 'json' and /// This is implemented for machine generatable formats 'json' and
/// 'json-pretty'. The 'text' format needs to be handled somewhere /// 'json-pretty'. The 'text' format needs to be handled somewhere
/// else. /// else.
pub fn format_and_print_result(result: Value, output_format: &str) { pub fn format_and_print_result(result: &Value, output_format: &str) {
if output_format == "json-pretty" { if output_format == "json-pretty" {
println!("{}", serde_json::to_string_pretty(&result).unwrap()); println!("{}", serde_json::to_string_pretty(&result).unwrap());