♻️ refactor(cli): use mutable client for subcommands
- change `client` to mutable to allow modification in subcommands - update subcommands to use the mutable `client`
This commit is contained in:
committed by
Jeremiah Russell
parent
92729c9ef4
commit
5331551eea
@@ -76,15 +76,15 @@ async fn run(args: Cli) -> Result<()> {
|
||||
let config = get_config()?;
|
||||
log::trace!("Configuration loaded: {config:#?}");
|
||||
|
||||
let client = GmailClient::new(config.credential_file()).await?;
|
||||
let mut client = GmailClient::new(config.credential_file()).await?;
|
||||
|
||||
match args.sub_command {
|
||||
SubCmds::Config(config_cli) => config_cli.run(config),
|
||||
SubCmds::Message(list_cli) => list_cli.run(&client).await,
|
||||
SubCmds::Message(list_cli) => list_cli.run(&mut client).await,
|
||||
SubCmds::Labels(label_cli) => label_cli.run(client).await,
|
||||
SubCmds::Trash(trash_cli) => trash_cli.run(&client).await,
|
||||
SubCmds::Delete(delete_cli) => delete_cli.run(&client).await,
|
||||
SubCmds::Run(run_cli) => run_cli.run(&client, config).await,
|
||||
SubCmds::Trash(trash_cli) => trash_cli.run(&mut client).await,
|
||||
SubCmds::Delete(delete_cli) => delete_cli.run(&mut client).await,
|
||||
SubCmds::Run(run_cli) => run_cli.run(&mut client, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user