monochromium 0.4.3

A fast, local-first CLI note-taking app for developers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::database::Database;
use crate::types::{MonoError, NoteTypes};
use crate::utils::pretty_notes;
use chrono::NaiveDate;

pub fn list(
    db: &Database,
    limit: Option<u16>,
    note_type: Option<NoteTypes>,
    _today: bool,
    _since: Option<NaiveDate>,
    view: bool,
) -> Result<Vec<String>, MonoError> {
    let final_limit: u16 = limit.unwrap_or(15);
    let notes = db.read_rows(final_limit as i32, note_type)?;

    Ok(pretty_notes(notes, view))
}