1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub mod colors;
pub mod entry;

use crate::entry::Entry;
use std::{env, error::Error, fs};

pub fn output() -> Result<(), Box<dyn Error>> {
    let entries = get_entries()?;

    for entry in entries {
        println!("{}", entry.print)
    }

    Ok(())
}

fn get_entries() -> Result<Vec<Entry>, Box<dyn Error>> {
    let mut entries = Vec::new();

    for path in fs::read_dir(env::current_dir()?)? {
        entries.push(Entry::from_path(&path?.path())?);
    }

    Ok(entries)
}