hammer_cli/fs_checks.rs
1use walkdir::DirEntry;
2use std::process::Command;
3
4pub fn is_hidden(entry: &DirEntry) -> bool {
5 entry.file_name()
6 .to_str()
7 .map(|s| s.starts_with("."))
8 .unwrap_or(false)
9}
10
11pub fn is_ignored(path: &str) -> bool {
12 let output = Command::new("git")
13 .arg("check-ignore")
14 .arg(format!("{}", path))
15 .output()
16 .expect("Failed to execute command - do you have git installed?");
17
18 output.stdout.len() > 0
19}