feat: add ability to list pwd

This commit is contained in:
2021-07-09 11:34:56 -04:00
parent e1b5e2f3c7
commit 002fff3eb4
3 changed files with 25 additions and 0 deletions

5
.gitignore vendored
View File

@@ -8,3 +8,8 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# Added by cargo
/target

8
Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "todara"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

12
src/main.rs Normal file
View File

@@ -0,0 +1,12 @@
use std::fs;
fn main() {
let paths = fs::read_dir(".").unwrap();
for result in paths {
let path = result.unwrap().path();
let metadata = fs::metadata(path.to_str().unwrap()).unwrap();
let type_ = if metadata.is_dir() { "Dirc" } else { "File" };
println!("{}: {}", type_, path.display())
}
}