diff --git a/src/main.rs b/src/main.rs index de87924..960d41d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,10 +11,27 @@ use etecal::session::{ restore_etebase_session, }; +#[derive(Subcommand, Clone)] +#[command(arg_required_else_help = true)] +enum EventCommands { + Show, +} + +impl Default for EventCommands { + fn default() -> Self { + return Self::Show; + } +} + #[derive(Subcommand, Clone)] #[command(arg_required_else_help = true)] enum CalendarCommands { Events, + Event { + uid: String, + #[command(subcommand)] + command: Option, + }, Name, SetName { name: String, @@ -90,6 +107,15 @@ fn main() -> Result<()> { println!("{} [{}]", item.meta()?.name().unwrap(), item.uid()); } }, + CalendarCommands::Event{uid, command} => { + let item = item_manager.fetch(uid, None)?; + + match &command.clone().unwrap_or_default() { + EventCommands::Show => { + println!("{}", String::from_utf8(item.content()?)?); + }, + } + }, CalendarCommands::Name => { println!("{} [{}]", meta.name().unwrap(), collection.uid()); },