From 06da00ac6856daa276dfcd29548ecdb6e82dca68 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Thu, 9 Oct 2025 07:12:47 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(cli):=20implement=20label=20su?= =?UTF-8?q?bcommand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - adds label subcommand to manage labels associated with rules - provides list, add, and remove subcommands for label management --- src/config_cli/label_cli.rs | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/config_cli/label_cli.rs diff --git a/src/config_cli/label_cli.rs b/src/config_cli/label_cli.rs new file mode 100644 index 0000000..e774051 --- /dev/null +++ b/src/config_cli/label_cli.rs @@ -0,0 +1,40 @@ +use clap::{Parser, Subcommand}; +use cull_gmail::{Config, Error}; + +mod add_cli; +mod list_cli; +mod remove_cli; + +use add_cli::AddCli; +use list_cli::ListCli; +use remove_cli::RemoveCli; + +#[derive(Debug, Subcommand)] +pub enum LabelCommands { + /// List the labels associated with a rule + #[clap(name = "list")] + List(ListCli), + /// Add label to rule + #[clap(name = "add")] + Add(AddCli), + /// Remove a label from a + #[clap(name = "remove", alias = "rm")] + Remove(RemoveCli), +} + +#[derive(Debug, Parser)] +pub struct LabelCli { + /// Configuration commands + #[command(subcommand)] + command: LabelCommands, +} + +impl LabelCli { + pub fn run(&self, config: Config) -> Result<(), Error> { + match &self.command { + LabelCommands::List(list_cli) => list_cli.run(config), + LabelCommands::Add(add_cli) => add_cli.run(config), + LabelCommands::Remove(rm_cli) => rm_cli.run(config), + } + } +}