2026-04-10 15:56:18 -03:00
|
|
|
//! Shared CLI helpers for the small `lesavka-common` utility binary.
|
|
|
|
|
|
|
|
|
|
/// Build the CLI banner shown by `lesavka-common`.
|
|
|
|
|
///
|
|
|
|
|
/// Inputs: the version string that should be displayed to the operator.
|
|
|
|
|
/// Outputs: a stable banner string that can be printed directly.
|
|
|
|
|
/// Why: keeping banner construction pure makes the tiny CLI testable without
|
|
|
|
|
/// depending on stdout capture in every caller.
|
|
|
|
|
#[must_use]
|
|
|
|
|
pub fn banner(version: &str) -> String {
|
|
|
|
|
format!("lesavka-common CLI (v{version})")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use super::banner;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn banner_includes_version() {
|
2026-04-19 11:42:41 -03:00
|
|
|
assert_eq!(banner("0.11.14"), "lesavka-common CLI (v0.11.14)");
|
2026-04-10 15:56:18 -03:00
|
|
|
}
|
|
|
|
|
}
|