feat(list): add pagination to list command

- add pages option to limit the number of pages to retrieve
- set default pages to 1
- modify list.run to accept the pages parameter
This commit is contained in:
Jeremiah Russell
2025-10-03 09:46:03 +01:00
committed by Jeremiah Russell
parent 0799086010
commit c58d8ca339

View File

@@ -4,8 +4,12 @@ use cull_gmail::{Error, List};
/// Command line options for the list subcommand
#[derive(Debug, Parser)]
pub struct ListCli {
/// Maximum results per page
#[arg(short, long, default_value = cull_gmail::DEFAULT_MAX_RESULTS)]
max_results: u32,
/// Maximum number of pages (0=all)
#[arg(short, long, default_value = "1")]
pages: u32,
}
impl ListCli {
@@ -16,6 +20,6 @@ impl ListCli {
list.set_max_results(self.max_results);
log::debug!("List max results set to {}", list.max_results());
list.run().await
list.run(self.pages).await
}
}