feat(list): add max results option to list command

- 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
This commit is contained in:
Jeremiah Russell
2025-10-02 16:41:49 +01:00
committed by Jeremiah Russell
parent e27f44c982
commit 9ac9e9ff00

View File

@@ -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
}
}