X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Fbin%2Fproxmox-backup-client.rs;h=410cf919af9ad3ea78d2f6b6e9fe42ecdce9ef78;hb=e5f7def40e1a4a66df8246df3890f773310aaa76;hp=011065484cb8759436895e593a0b37480cdf0ad7;hpb=0ec9e1b010c8bdfbc3e9262187cec5216fa107d3;p=proxmox-backup.git diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index 01106548..410cf919 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -536,16 +536,31 @@ fn start_garbage_collection( ) -> Result { let repo = extract_repository_from_value(¶m)?; + let output_format = param["output-format"].as_str().unwrap_or("text").to_owned(); let mut client = HttpClient::new(repo.host(), repo.user(), None)?; let path = format!("api2/json/admin/datastore/{}/gc", repo.store()); - let result = async_main(async move { client.post(&path, None).await })?; + async_main(async { + let result = client.post(&path, None).await?; - record_repository(&repo); + record_repository(&repo); - Ok(result) + let data = &result["data"]; + if output_format == "text" { + if let Some(upid) = data.as_str() { + display_task_log(client, upid, true).await?; + } + } else { + format_and_print_result(&data, &output_format); + } + + Ok::<_, Error>(()) + })?; + + + Ok(Value::Null) } fn parse_backupspec(value: &str) -> Result<(&str, &str), Error> {