✨ 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:
committed by
Jeremiah Russell
parent
e27f44c982
commit
9ac9e9ff00
@@ -3,11 +3,19 @@ use cull_gmail::{Error, List};
|
|||||||
|
|
||||||
/// Command line options for the list subcommand
|
/// Command line options for the list subcommand
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
pub struct ListCli {}
|
pub struct ListCli {
|
||||||
|
#[arg(short, long, default_value = cull_gmail::DEFAULT_MAX_RESULTS)]
|
||||||
|
max_results: u32,
|
||||||
|
}
|
||||||
|
|
||||||
impl ListCli {
|
impl ListCli {
|
||||||
pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> {
|
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
|
list.run().await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user