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

pub async fn list_todos(
    conn: libsql::Connection,
    limit: Option<u16>,
    _today: bool,
    _since: Option<NaiveDate>,
    view: bool,
) -> Result<Vec<String>, Box<dyn std::error::Error>> {
    let limit = limit.unwrap_or(10);
    let notes = read_rows(conn, limit as i32, Some(NoteTypes::Todo)).await?;
    Ok(pretty_notes(notes, view))
}