feat: add ability to list pwd
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -8,3 +8,8 @@ Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
||||
8
Cargo.toml
Normal file
8
Cargo.toml
Normal 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
12
src/main.rs
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user