purefetch 0.1.2

A fast, fastfetch-style system information tool written entirely in Rust with zero dependencies
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Disk (/): used / total (percent) via statfs(2) on the root mount.
//! Works on ZFS-on-root (unicorn) as on any other filesystem.
use crate::detect::{Row, Rows};
use crate::util::{human_iec, percent};

pub fn detect() -> Rows {
    let Some(d) = crate::sys::disk_usage("/") else {
        return Vec::new();
    };
    vec![Row::val(format!(
        "{} / {} ({}%)",
        human_iec(d.used),
        human_iec(d.total),
        percent(d.used, d.total)
    ))]
}