From 9ac9e9ff00e4b6681a0a2388e66ab1961c619d85 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Thu, 2 Oct 2025 16:41:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(list):=20add=20max=20results?= =?UTF-8?q?=20option=20to=20list=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - allow users to specify the maximum number of results to return - add `max_results` argument to the `ListCli` struct - set the max results on the `List` struct --- src/list_cli.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/list_cli.rs b/src/list_cli.rs index 24756fa..ad03639 100644 --- a/src/list_cli.rs +++ b/src/list_cli.rs @@ -3,11 +3,19 @@ use cull_gmail::{Error, List}; /// Command line options for the list subcommand #[derive(Debug, Parser)] -pub struct ListCli {} +pub struct ListCli { + #[arg(short, long, default_value = cull_gmail::DEFAULT_MAX_RESULTS)] + max_results: u32, +} impl ListCli { pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> { - let list = List::new(credential_file).await?; + log::debug!("Max results: `{}`", self.max_results); + + let mut list = List::new(credential_file).await?; + list.set_max_results(self.max_results); + log::debug!("List max results set to {}", list.max_results()); + list.run().await } }