Print markers for logs and entry descriptions
This commit is contained in:
parent
b3d81a8d0a
commit
4a46e70a73
5 changed files with 78 additions and 25 deletions
10
src/files.rs
10
src/files.rs
|
|
@ -7,7 +7,7 @@ use chrono::{DateTime, NaiveDate, Utc};
|
|||
use codespan_reporting::files::SimpleFiles;
|
||||
use tzfile::Tz;
|
||||
|
||||
use self::commands::{Command, Done, File};
|
||||
use self::commands::{Command, Done, File, Log};
|
||||
pub use self::error::{Error, Result};
|
||||
use self::primitives::Spanned;
|
||||
|
||||
|
|
@ -311,6 +311,14 @@ impl Files {
|
|||
Self::command_of_files(&self.files, source)
|
||||
}
|
||||
|
||||
pub fn log(&self, date: NaiveDate) -> Option<&Log> {
|
||||
let source = *self.logs.get(&date)?;
|
||||
match self.command(source).command {
|
||||
Command::Log(log) => Some(log),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn now(&self) -> DateTime<&Tz> {
|
||||
if let Some(tz) = &self.timezone {
|
||||
Utc::now().with_timezone(&tz)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue