From bebf00acb4ae61758140069a50297c72ccb01a7d Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Wed, 8 Oct 2025 06:16:56 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(cli):=20restructu?= =?UTF-8?q?re=20cli=20commands=20and=20config=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rename config cli to rules cli for better clarity - move config loading to rules cli for better modularity - update command matching to use the new rules cli --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index be17f2a..bebc137 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,14 @@ use clap::{Parser, Subcommand}; -mod config_cli; mod label_cli; mod message_cli; +mod rules_cli; mod trash_cli; -use config_cli::ConfigCli; use cull_gmail::{Config, Error}; use label_cli::LabelCli; use message_cli::MessageCli; +use rules_cli::RulesCli; use std::error::Error as stdError; use trash_cli::TrashCli; @@ -34,8 +34,8 @@ enum Commands { #[clap(name = "trash")] Trash(TrashCli), /// Configure end-of-life rules - #[clap(name = "config")] - Config(ConfigCli), + #[clap(name = "rules")] + Rules(RulesCli), } #[tokio::main] @@ -66,9 +66,9 @@ async fn run(args: Cli) -> Result<(), Error> { if let Some(cmds) = args.command { match cmds { Commands::Message(list_cli) => list_cli.run(config.credential_file()).await?, - Commands::Labels(label_cli) => label_cli.run("credential.json").await?, - Commands::Trash(trash_cli) => trash_cli.run("credential.json").await?, - Commands::Config(config_cli) => config_cli.run(), + Commands::Labels(label_cli) => label_cli.run(config.credential_file()).await?, + Commands::Trash(trash_cli) => trash_cli.run(config.credential_file()).await?, + Commands::Rules(config_cli) => config_cli.run(config), } } Ok(())