♻️ refactor(list): refactor list command to accept credential file

- update list command to accept credential file path
- create gmail hub in list command
This commit is contained in:
Jeremiah Russell
2025-10-02 13:45:16 +01:00
committed by Jeremiah Russell
parent dc1a52e39b
commit 44c9220eb1

View File

@@ -1,16 +1,13 @@
use clap::Parser; use clap::Parser;
use cull_gmail::List; use cull_gmail::{Error, List};
use google_gmail1::{
Gmail, hyper_rustls::HttpsConnector, hyper_util::client::legacy::connect::HttpConnector,
};
/// 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 {}
impl ListCli { impl ListCli {
pub(crate) async fn run(&self, hub: Gmail<HttpsConnector<HttpConnector>>) { pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> {
let list = List::new(hub); let list = List::new(credential_file).await?;
list.run().await; list.run().await
} }
} }