clew 0.1.3

A lightweight, local, git-native project tracker for humans and agents.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::error::ClewError;
use crate::storage::fs;
use std::io::Write;

pub fn run(query: &str) -> Result<(), ClewError> {
    let cwd = std::env::current_dir().map_err(ClewError::Io)?;
    let root = fs::find_clew_root(&cwd)?;
    let path = fs::resolve(&root, query)?;
    let contents = fs::read_file(&path)?;
    let stdout = std::io::stdout();
    let mut handle = stdout.lock();
    handle
        .write_all(contents.as_bytes())
        .map_err(ClewError::Io)?;
    Ok(())
}