Display event content

This commit is contained in:
clerie 2025-01-04 20:11:26 +01:00
parent 6fadc916f4
commit a7056f459e

View File

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