Skip to content

Commit 1606574

Browse files
committed
Add list-files command for inspecting Zeta Crypto working directory
1 parent 72d36e3 commit 1606574

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bin/cli.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum Commands {
5656
LogSize,
5757
CachePath,
5858
DataDir,
59+
ListFiles,
5960
}
6061

6162
fn main() -> Result<()> {
@@ -290,6 +291,21 @@ fn main() -> Result<()> {
290291
dir.push(".zeta_crypto");
291292
println!("{}", dir.display());
292293
}
294+
Commands::ListFiles => {
295+
use std::fs;
296+
297+
let mut dir = dirs::home_dir().unwrap_or_else(|| std::path::PathBuf::from("."));
298+
dir.push(".zeta_crypto");
299+
300+
match fs::read_dir(&dir) {
301+
Ok(entries) => {
302+
for entry in entries.flatten() {
303+
println!("{}", entry.path().display());
304+
}
305+
}
306+
Err(_) => println!("Directory not found: {}", dir.display()),
307+
}
308+
}
293309
}
294310

295311
Ok(())

0 commit comments

Comments
 (0)