monochromium 0.2.0

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::read_rows;
use crate::types::NoteTypes;
use crate::utils::pretty_notes;
use chrono::NaiveDate;

pub async fn list(
    conn: libsql::Connection,
    limit: Option<u16>,
    note_type: Option<NoteTypes>,
    _today: bool,
    _since: Option<NaiveDate>,
    view: bool,
) -> Result<Vec<String>, Box<dyn std::error::Error>> {
    let final_limit: u16 = limit.unwrap_or(15);
    let notes = read_rows(conn, final_limit as i32, note_type).await?;

    Ok(pretty_notes(notes, view))
}