Skip to content

Commit

Permalink
Add event type to possible columns in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed May 28, 2024
1 parent a32795a commit c255755
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/src/formatting/event_listing.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use ascii_table::AsciiTable;
use clap::ValueEnum;
use emfcamp_schedule_api::schedule::event::Event;
use emfcamp_schedule_api::schedule::event::{Event, Kind};
use std::fmt::Display;

#[derive(Debug, Clone, ValueEnum)]
pub(crate) enum Column {
Id,
Slug,
Type,
Start,
StartVerbose,
End,
Expand All @@ -22,6 +23,13 @@ impl Column {
match self {
Column::Id => event.id.to_string(),
Column::Slug => event.slug.clone(),
Column::Type => match event.kind {
Kind::Talk => "Talk",
Kind::Workshop(_) => "Workshop",
Kind::YouthWorkshop => "Youth Workshop",
Kind::Performance => "Performance",
}
.to_string(),
Column::Start => event.start.format("%a %H:%M").to_string(),
Column::StartVerbose => event.start.format("%Y-%m-%d %H:%M").to_string(),
Column::End => event.end.format("%a %H:%M").to_string(),
Expand All @@ -39,6 +47,7 @@ impl Display for Column {
let text = match &self {
Column::Id => "ID",
Column::Slug => "Slug",
Column::Type => "Type",
Column::Start => "Start",
Column::StartVerbose => "Start",
Column::End => "End",
Expand All @@ -58,6 +67,7 @@ pub(crate) fn default_columns() -> Vec<Column> {
Column::Start,
Column::End,
Column::Venue,
Column::Type,
Column::Title,
]
}
Expand Down

0 comments on commit c255755

Please sign in to comment.