From 2276aae8c50d929d0caafc3308433781f33faeaf Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 12 Dec 2021 17:16:14 +0000 Subject: [PATCH] Improve format I think the new format is more readable than the old one, but I might change it around again when I add colors. --- src/cli/layout.rs | 2 + src/cli/render.rs | 223 +++++++++++++++++++++++++++++----------- src/files/primitives.rs | 15 +++ 3 files changed, 178 insertions(+), 62 deletions(-) diff --git a/src/cli/layout.rs b/src/cli/layout.rs index 47f0c43..0da4358 100644 --- a/src/cli/layout.rs +++ b/src/cli/layout.rs @@ -60,6 +60,8 @@ impl Layout { for (_, day) in self.days.iter_mut() { Self::sort_day(day); } + + // TODO Combine TimedStart and TimedEnd if there is nothing in-between } fn layout_entry(&mut self, index: usize, entry: &Entry) { diff --git a/src/cli/render.rs b/src/cli/render.rs index 7f26500..cb2de2f 100644 --- a/src/cli/render.rs +++ b/src/cli/render.rs @@ -1,8 +1,10 @@ +use std::cmp; use std::collections::HashMap; +use chrono::{Datelike, NaiveDate}; + use crate::eval::{Entry, EntryKind}; -use crate::files::commands::Command; -use crate::files::primitives::Time; +use crate::files::primitives::{Time, Weekday}; use crate::files::Files; use super::layout::{Layout, LayoutEntry}; @@ -14,11 +16,21 @@ enum SpanSegment { End, } -struct Line { - number: Option, - spans: Vec>, - time: Option