~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
17 lines · 484 B Raw History
use std::io::Read;
use tally::count;

fn main() {
    let path = std::env::args().nth(1);
    let text = match &path {
        Some(path) => std::fs::read_to_string(path).unwrap(),
        None => {
            let mut text = String::new();
            std::io::stdin().read_to_string(&mut text).unwrap();
            text
        }
    };
    let c = count(&text);
    let name = path.as_deref().unwrap_or("-");
    println!("{:>8} {:>8} {:>8} {name}", c.lines, c.words, c.bytes);
}