-
Notifications
You must be signed in to change notification settings - Fork 0
Workspace Architecture
Ken Tobias edited this page May 31, 2026
·
12 revisions
retch is structured as a Cargo workspace to keep the codebase modular, clean, and reusable.
.
├── Cargo.toml # Root workspace config
├── Cargo.lock
├── Justfile # Command runner scripts
├── README.md
├── docs/ # Manual pages & documentation
├── src/ # retch-cli source code
│ ├── cli.rs # Clap arguments and flags
│ ├── config.rs # TOML parsing & merge logic
│ ├── fetch.rs # Parallel system info fetching
│ ├── main.rs # Entry point and config creation
│ └── ...
└── crates/
└── battery/ # retch-battery subcrate (standalone library)
├── Cargo.toml
└── src/
└── lib.rs # Cross-platform battery implementation
The root Cargo.toml specifies the workspace members:
[workspace]
members = [
".",
"crates/battery",
]The main binary command-line interface. It handles concurrent scoped threading, terminal detection, the configuration parsing engine, and formatting formatting to render output screens.
A lightweight, standalone, zero-dependency library to query battery statistics on Linux, macOS, and Windows.
-
linux: Directly reads from
/sys/class/power_supply/. -
macos: Directly calls the native CoreFoundation
IOPSCopyPowerSourcesInfoAPIs. - windows: Invokes WMI queries via command utilities.
- It operates with zero heavy dependencies (no
nixor custom C bindings), making it extremely quick to build and safe to use.