src/bin/proxmox-backup-client.rs - list_snapshot_files: use format_and_print_result_full()

This commit is contained in:
Dietmar Maurer 2020-02-26 13:49:47 +01:00
parent 390c5bdde4
commit ea5f547fdc
2 changed files with 11 additions and 15 deletions

View File

@ -138,7 +138,7 @@ fn list_groups(
}, },
)] )]
/// List snapshot files. /// List snapshot files.
fn list_snapshot_files( pub fn list_snapshot_files(
store: String, store: String,
backup_type: String, backup_type: String,
backup_id: String, backup_id: String,
@ -293,7 +293,7 @@ fn list_snapshots (
}, },
)] )]
/// Get datastore status. /// Get datastore status.
fn status( pub fn status(
store: String, store: String,
_info: &ApiMethod, _info: &ApiMethod,
_rpcenv: &mut dyn RpcEnvironment, _rpcenv: &mut dyn RpcEnvironment,

View File

@ -671,19 +671,15 @@ async fn list_snapshot_files(param: Value) -> Result<Value, Error> {
record_repository(&repo); record_repository(&repo);
let list: Value = result["data"].take(); let info = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_LIST_SNAPSHOT_FILES;
if output_format == "text" { let mut data: Value = result["data"].take();
for item in list.as_array().unwrap().iter() {
println!( let options = TableFormatOptions::new()
"{} {}", .noborder(false)
strip_server_file_expenstion(item["filename"].as_str().unwrap()), .noheader(false);
item["size"].as_u64().unwrap_or(0),
); format_and_print_result_full(&mut data, info, &output_format, &options);
}
} else {
format_and_print_result(&list, &output_format);
}
Ok(Value::Null) Ok(Value::Null)
} }
@ -1489,7 +1485,7 @@ async fn status(param: Value) -> Result<Value, Error> {
.column(ColumnConfig::new("used").renderer(render_total_percentage)) .column(ColumnConfig::new("used").renderer(render_total_percentage))
.column(ColumnConfig::new("avail").renderer(render_total_percentage)); .column(ColumnConfig::new("avail").renderer(render_total_percentage));
let schema = &proxmox_backup::api2::types::StorageStatus::API_SCHEMA; let schema = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_STATUS;
format_and_print_result_full(&mut data, schema, &output_format, &options); format_and_print_result_full(&mut data, schema, &output_format, &options);