From c25ea25f0aa622a77410df0c9cf8eae134cfbd34 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 21 Sep 2021 15:11:36 +0200 Subject: [PATCH] debug: api ls: make path optional and default to "/" Signed-off-by: Thomas Lamprecht --- src/bin/proxmox_backup_debug/api.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox_backup_debug/api.rs b/src/bin/proxmox_backup_debug/api.rs index 0292e628..bebe9ddc 100644 --- a/src/bin/proxmox_backup_debug/api.rs +++ b/src/bin/proxmox_backup_debug/api.rs @@ -424,6 +424,7 @@ async fn get_api_children( path: { type: String, description: "API path.", + optional: true, }, "output-format": { schema: OUTPUT_FORMAT, @@ -433,7 +434,7 @@ async fn get_api_children( }, )] /// Get API usage information for -async fn ls(path: String, mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> { +async fn ls(path: Option, mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> { let output_format = extract_output_format(&mut param); let options = TableFormatOptions::new() @@ -441,7 +442,7 @@ async fn ls(path: String, mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> .noheader(true) .sortby("name", false); - let res = get_api_children(path, rpcenv).await?; + let res = get_api_children(path.unwrap_or(String::from("/")), rpcenv).await?; format_and_print_result_full( &mut serde_json::to_value(res)?,