src/bin/proxmox-backup-client.rs: use new output formath helpers from proxmox 0.15.1-1
This commit is contained in:
parent
e23f586344
commit
c2043614f7
@ -34,7 +34,7 @@ pam = "0.7"
|
|||||||
pam-sys = "0.5"
|
pam-sys = "0.5"
|
||||||
percent-encoding = "2.1"
|
percent-encoding = "2.1"
|
||||||
pin-utils = "0.1.0-alpha"
|
pin-utils = "0.1.0-alpha"
|
||||||
proxmox = { version = "0.1.14", features = [ "sortable-macro", "api-macro" ] }
|
proxmox = { version = "0.1.15", features = [ "sortable-macro", "api-macro" ] }
|
||||||
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
|
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
|
||||||
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
|
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
|
||||||
regex = "1.2"
|
regex = "1.2"
|
||||||
|
@ -367,7 +367,7 @@ async fn list_backup_groups(param: Value) -> Result<Value, Error> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ async fn list_snapshots(param: Value) -> Result<Value, Error> {
|
|||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let client = connect(repo.host(), repo.user())?;
|
let client = connect(repo.host(), repo.user())?;
|
||||||
|
|
||||||
@ -465,9 +465,7 @@ async fn list_snapshots(param: Value) -> Result<Value, Error> {
|
|||||||
Ok(tools::join(&files, ' '))
|
Ok(tools::join(&files, ' '))
|
||||||
};
|
};
|
||||||
|
|
||||||
let options = TableFormatOptions::new()
|
let options = default_table_format_options()
|
||||||
.noborder(false)
|
|
||||||
.noheader(false)
|
|
||||||
.sortby("backup-type", false)
|
.sortby("backup-type", false)
|
||||||
.sortby("backup-id", false)
|
.sortby("backup-id", false)
|
||||||
.sortby("backup-time", false)
|
.sortby("backup-time", false)
|
||||||
@ -663,7 +661,7 @@ async fn list_snapshot_files(param: Value) -> Result<Value, Error> {
|
|||||||
let path = tools::required_string_param(¶m, "snapshot")?;
|
let path = tools::required_string_param(¶m, "snapshot")?;
|
||||||
let snapshot = BackupDir::parse(path)?;
|
let snapshot = BackupDir::parse(path)?;
|
||||||
|
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let client = connect(repo.host(), repo.user())?;
|
let client = connect(repo.host(), repo.user())?;
|
||||||
|
|
||||||
@ -681,9 +679,7 @@ async fn list_snapshot_files(param: Value) -> Result<Value, Error> {
|
|||||||
|
|
||||||
let mut data: Value = result["data"].take();
|
let mut data: Value = result["data"].take();
|
||||||
|
|
||||||
let options = TableFormatOptions::new()
|
let options = default_table_format_options();
|
||||||
.noborder(false)
|
|
||||||
.noheader(false);
|
|
||||||
|
|
||||||
format_and_print_result_full(&mut data, info, &output_format, &options);
|
format_and_print_result_full(&mut data, info, &output_format, &options);
|
||||||
|
|
||||||
@ -708,7 +704,8 @@ async fn list_snapshot_files(param: Value) -> Result<Value, Error> {
|
|||||||
async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
|
async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
|
||||||
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let mut client = connect(repo.host(), repo.user())?;
|
let mut client = connect(repo.host(), repo.user())?;
|
||||||
|
|
||||||
@ -1428,7 +1425,8 @@ async fn prune_async(mut param: Value) -> Result<Value, Error> {
|
|||||||
|
|
||||||
let group = tools::required_string_param(¶m, "group")?;
|
let group = tools::required_string_param(¶m, "group")?;
|
||||||
let group = BackupGroup::parse(group)?;
|
let group = BackupGroup::parse(group)?;
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
|
||||||
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
param.as_object_mut().unwrap().remove("repository");
|
param.as_object_mut().unwrap().remove("repository");
|
||||||
param.as_object_mut().unwrap().remove("group");
|
param.as_object_mut().unwrap().remove("group");
|
||||||
@ -1465,7 +1463,7 @@ async fn status(param: Value) -> Result<Value, Error> {
|
|||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
|
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let client = connect(repo.host(), repo.user())?;
|
let client = connect(repo.host(), repo.user())?;
|
||||||
|
|
||||||
@ -1485,8 +1483,7 @@ async fn status(param: Value) -> Result<Value, Error> {
|
|||||||
Ok(format!("{} {:>8}", v, info))
|
Ok(format!("{} {:>8}", v, info))
|
||||||
};
|
};
|
||||||
|
|
||||||
let options = TableFormatOptions::new()
|
let options = default_table_format_options()
|
||||||
.noborder(false)
|
|
||||||
.noheader(true)
|
.noheader(true)
|
||||||
.column(ColumnConfig::new("total").renderer(render_total_percentage))
|
.column(ColumnConfig::new("total").renderer(render_total_percentage))
|
||||||
.column(ColumnConfig::new("used").renderer(render_total_percentage))
|
.column(ColumnConfig::new("used").renderer(render_total_percentage))
|
||||||
@ -2207,7 +2204,8 @@ fn catalog_mgmt_cli() -> CliCommandMap {
|
|||||||
/// List running server tasks for this repo user
|
/// List running server tasks for this repo user
|
||||||
async fn task_list(param: Value) -> Result<Value, Error> {
|
async fn task_list(param: Value) -> Result<Value, Error> {
|
||||||
|
|
||||||
let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
let repo = extract_repository_from_value(¶m)?;
|
let repo = extract_repository_from_value(¶m)?;
|
||||||
let client = connect(repo.host(), repo.user())?;
|
let client = connect(repo.host(), repo.user())?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user