jannie

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 650cc623aeb211fa79d44aaf9a00cff2f33000d6
parent c70b1d6c528428a206d10ed68f6d29c2db58ce17
Author: Andy Khramtsov <>
Date:   Tue, 10 Feb 2026 14:52:15 +0300

feat: support no check info

Diffstat:
Msrc/lib.rs | 29+++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs @@ -38,7 +38,7 @@ pub fn result_main() -> Result<(), Error> { #[derive(Clone, Debug)] struct Meta { - inventory: Option<String>, + inventory: Option<Option<String>>, blacklist: Option<bool>, } @@ -89,16 +89,18 @@ async fn read(state: &State) { .map(|node| node.borrow().meta().clone()) .flatten() .map(|check| match check { - inventory::Check::None => "".to_string(), - inventory::Check::Shell(cmd) => String::from_utf8( - std::process::Command::new("sh") - .arg("-c") - .arg(cmd) - .output() - .expect("Should finish command") - .stdout, - ) - .expect("Should be utf8 string"), + inventory::Check::None => None, + inventory::Check::Shell(cmd) => Some( + String::from_utf8( + std::process::Command::new("sh") + .arg("-c") + .arg(cmd) + .output() + .expect("Should finish command") + .stdout, + ) + .expect("Should be utf8 string"), + ), }); if base != dir { @@ -229,11 +231,10 @@ fn print(tree: &Filetree<Meta>) -> Result<(), Error> { .to_owned(); let offset_text = " ".repeat(offset); if let Some(msg) = node.borrow().meta().inventory.as_ref() { + let msg = msg.as_deref().unwrap_or("\x1b[31mno info\x1b[0m"); println!( "{}\x1b[2m|\x1b[0m \x1b[32m/{}\x1b[0m \x1b[3m{}\x1b[0m", - offset_text, - name, - msg.trim() + offset_text, name, msg, ); } else if let Some(true) = node.borrow().meta().blacklist { println!("{}\x1b[2m|\x1b[0m \x1b[2;9m/{}\x1b[0m", offset_text, name);