mod create;
mod delete;
mod list;
mod update;
use anyhow::Result;
use clap::Subcommand;
use pimalaya_toolbox::terminal::printer::Printer;
use crate::account::Account;
use self::{
create::CreateCalendarCommand, delete::DeleteCalendarCommand, list::ListCalendarsCommand,
update::UpdateCalendarCommand,
};
#[derive(Debug, Subcommand)]
pub enum CalendarSubcommand {
#[command(alias = "new", alias = "add")]
Create(CreateCalendarCommand),
List(ListCalendarsCommand),
#[command(alias = "set")]
Update(UpdateCalendarCommand),
#[command(alias = "remove", alias = "rm")]
Delete(DeleteCalendarCommand),
}
impl CalendarSubcommand {
pub fn execute(self, printer: &mut impl Printer, account: Account) -> Result<()> {
match self {
Self::Create(cmd) => cmd.execute(printer, account),
Self::List(cmd) => cmd.execute(printer, account),
Self::Update(cmd) => cmd.execute(printer, account),
Self::Delete(cmd) => cmd.execute(printer, account),
}
}
}