diff options
| author | Joris | 2022-03-20 12:57:22 +0100 | 
|---|---|---|
| committer | Joris | 2022-03-20 12:57:44 +0100 | 
| commit | a77b96ddd1c2fb118aad785b6b7b452d71c61c20 (patch) | |
| tree | 8547ceb569efeb8d31391d653329f2d5b1e66a80 /src/cli | |
| parent | 6277be699e613756fb786a524f71ddbe509ab81e (diff) | |
Don’t add a newline if there is no event in CLI
This fixes counting 1 event when piping `wc -l`.
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/mod.rs | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 88726ca..81c5895 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -2,7 +2,7 @@ use anyhow::Result;  use chrono::Local;  use rusqlite::Connection; -use crate::{db, model::event, model::event::Event}; +use crate::{db, model::event};  pub fn today(conn: &Connection) -> Result<String> {      let today = Local::today().naive_local(); @@ -15,7 +15,7 @@ pub fn today(conn: &Connection) -> Result<String> {      events.sort_by_key(|e| e.start);      Ok(events          .iter() -        .map(Event::pprint) +        .map(|e| format!("{}\n", e.pprint()))          .collect::<Vec<String>>() -        .join("\n")) +        .join(""))  } | 
