diff --git a/clients/rust/crates/mxgw-cli/src/main.rs b/clients/rust/crates/mxgw-cli/src/main.rs index 169267f..299b97f 100644 --- a/clients/rust/crates/mxgw-cli/src/main.rs +++ b/clients/rust/crates/mxgw-cli/src/main.rs @@ -423,6 +423,7 @@ enum GalaxyCommand { historized_only: bool, /// Number of additional levels to eagerly expand beneath each returned /// node. 0 (the default) prints only the requested level. + /// Ignored when --parent-gobject-id is specified. #[arg(long, default_value_t = 0)] depth: usize, #[arg(long)] @@ -1156,11 +1157,15 @@ async fn run_galaxy(command: GalaxyCommand) -> Result<(), Error> { depth, json, } => { + if parent_gobject_id.is_some() && depth > 0 { + eprintln!("warning: --depth is ignored when --parent-gobject-id is specified"); + } + let mut client = connect_galaxy(connection).await?; let options = BrowseChildrenOptions { - category_ids: category_ids.clone(), - template_chain_contains: template_chain_contains.clone(), - tag_name_glob: tag_name_glob.clone(), + category_ids, + template_chain_contains, + tag_name_glob, include_attributes: include_attributes.then_some(true), alarm_bearing_only, historized_only, @@ -1201,6 +1206,11 @@ async fn run_galaxy(command: GalaxyCommand) -> Result<(), Error> { Ok(()) } +/// Page size used for the raw `BrowseChildren` RPC when fetching a single +/// level via `--parent-gobject-id`. Mirrors `BROWSE_CHILDREN_PAGE_SIZE` in +/// `galaxy.rs` (the library's lazy-browse helper uses the same value). +const BROWSE_PAGE_SIZE: i32 = 500; + /// Drive `BrowseChildren` paging by hand for a single parent and return the /// flattened child list. Used by the `browse --parent-gobject-id` path, which /// surfaces one level of children rather than the lazy root-tree walk. @@ -1219,7 +1229,7 @@ async fn browse_children_one_level( let mut seen: HashSet = HashSet::new(); loop { let request = BrowseChildrenRequest { - page_size: 500, + page_size: BROWSE_PAGE_SIZE, page_token: page_token.clone(), category_ids: options.category_ids.clone(), template_chain_contains: options.template_chain_contains.clone(),