From 4eb8a479c26b531474d04ba4f9e479f3d732bb2d Mon Sep 17 00:00:00 2001 From: lognarly Date: Sat, 9 May 2026 21:55:51 -0400 Subject: [PATCH 1/2] feat(infrastructure): add start, include_muted_hosts_data, and include_hosts_metadata params to hosts list Expose three previously unsupported ListHostsOptionalParams fields on `pup infrastructure hosts list`: - --start: offset for paginated results - --include-muted-hosts-data: include data for muted hosts - --include-hosts-metadata: include host metadata (agent version, cpu, etc.) Co-Authored-By: Claude Sonnet 4.6 --- src/commands/infrastructure.rs | 32 ++++++++++++++++++++++++++++++-- src/main.rs | 20 +++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/commands/infrastructure.rs b/src/commands/infrastructure.rs index aa59e735..ac0bffc2 100644 --- a/src/commands/infrastructure.rs +++ b/src/commands/infrastructure.rs @@ -9,14 +9,22 @@ pub async fn hosts_list( filter: Option, sort: String, count: i64, + start: Option, + include_muted_hosts_data: bool, + include_hosts_metadata: bool, ) -> Result<()> { let api = crate::make_api!(HostsAPI, cfg); let mut params = ListHostsOptionalParams::default() .count(count) - .sort_field(sort); + .sort_field(sort) + .include_muted_hosts_data(include_muted_hosts_data) + .include_hosts_metadata(include_hosts_metadata); if let Some(f) = filter { params = params.filter(f); } + if let Some(s) = start { + params = params.start(s); + } let resp = api .list_hosts(params) .await @@ -49,7 +57,27 @@ mod tests { let mut s = mockito::Server::new_async().await; let cfg = test_config(&s.url()); mock_all(&mut s, r#"{"host_list": [], "total_returned": 0}"#).await; - let _ = super::hosts_list(&cfg, None, "name".into(), 10).await; + let _ = super::hosts_list(&cfg, None, "name".into(), 10, None, false, false).await; + cleanup_env(); + } + + #[tokio::test] + async fn test_infrastructure_hosts_list_with_start() { + let _lock = lock_env().await; + let mut s = mockito::Server::new_async().await; + let cfg = test_config(&s.url()); + mock_all(&mut s, r#"{"host_list": [], "total_returned": 0}"#).await; + let _ = super::hosts_list(&cfg, None, "name".into(), 10, Some(100), false, false).await; + cleanup_env(); + } + + #[tokio::test] + async fn test_infrastructure_hosts_list_with_metadata_flags() { + let _lock = lock_env().await; + let mut s = mockito::Server::new_async().await; + let cfg = test_config(&s.url()); + mock_all(&mut s, r#"{"host_list": [], "total_returned": 0}"#).await; + let _ = super::hosts_list(&cfg, None, "name".into(), 10, None, true, true).await; cleanup_env(); } } diff --git a/src/main.rs b/src/main.rs index d3a22604..e40bf27e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4350,6 +4350,12 @@ enum InfraHostActions { sort: String, #[arg(long, default_value_t = 100, help = "Maximum hosts")] count: i64, + #[arg(long, help = "Starting offset for paginated results")] + start: Option, + #[arg(long, help = "Include data for muted hosts")] + include_muted_hosts_data: bool, + #[arg(long, help = "Include host metadata (agent version, cpu, etc.)")] + include_hosts_metadata: bool, }, /// Get host details Get { hostname: String }, @@ -11263,8 +11269,20 @@ async fn main_inner() -> anyhow::Result<()> { filter, sort, count, + start, + include_muted_hosts_data, + include_hosts_metadata, } => { - commands::infrastructure::hosts_list(&cfg, filter, sort, count).await?; + commands::infrastructure::hosts_list( + &cfg, + filter, + sort, + count, + start, + include_muted_hosts_data, + include_hosts_metadata, + ) + .await?; } InfraHostActions::Get { hostname } => { commands::infrastructure::hosts_get(&cfg, &hostname).await?; From b3d82042ccccdde9238d60d809ec5d162e80fe40 Mon Sep 17 00:00:00 2001 From: lognarly Date: Sat, 9 May 2026 22:03:13 -0400 Subject: [PATCH 2/2] remove claude-generated tests --- src/commands/infrastructure.rs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/commands/infrastructure.rs b/src/commands/infrastructure.rs index ac0bffc2..1e5e15b6 100644 --- a/src/commands/infrastructure.rs +++ b/src/commands/infrastructure.rs @@ -60,24 +60,4 @@ mod tests { let _ = super::hosts_list(&cfg, None, "name".into(), 10, None, false, false).await; cleanup_env(); } - - #[tokio::test] - async fn test_infrastructure_hosts_list_with_start() { - let _lock = lock_env().await; - let mut s = mockito::Server::new_async().await; - let cfg = test_config(&s.url()); - mock_all(&mut s, r#"{"host_list": [], "total_returned": 0}"#).await; - let _ = super::hosts_list(&cfg, None, "name".into(), 10, Some(100), false, false).await; - cleanup_env(); - } - - #[tokio::test] - async fn test_infrastructure_hosts_list_with_metadata_flags() { - let _lock = lock_env().await; - let mut s = mockito::Server::new_async().await; - let cfg = test_config(&s.url()); - mock_all(&mut s, r#"{"host_list": [], "total_returned": 0}"#).await; - let _ = super::hosts_list(&cfg, None, "name".into(), 10, None, true, true).await; - cleanup_env(); - } }