feat(cli): implement label subcommand

- adds label subcommand to manage labels associated with rules
- provides list, add, and remove subcommands for label management
This commit is contained in:
Jeremiah Russell
2025-10-09 07:12:47 +01:00
committed by Jeremiah Russell
parent 098160ab78
commit 06da00ac68

View File

@@ -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),
}
}
}