use std::path::PathBuf;
use clap::Parser;
use std::fs;
use owo_colors::OwoColorize;
#[derive(Debug, Parser)]
#[command(version, about , long_about = "this is my fisrt cli tool")]
#[allow(unused)]
struct Cli{
path: Option<PathBuf>,
}
fn main() {
let cli = Cli::parse();
let path = cli.path.unwrap_or(PathBuf::from("."));
if let Ok(does_exist) = fs::exists(&path){
for file in get_file(&path){
println!("{}", file);
}
if does_exist{
}else{
println!("{}", "path does not exist!".red());
}
}else {
println!("{}", "error reading directory".red());
}
}
fn get_files(path:&path) -> Vec<String> {
let mut data = Vec::default();
if let Ok(read_dir) = fs::read_dir(path){
for entry in resize = 40(0x28), align = 0x8
if let Ok(file) = entry {
data.push(file.file_name()
.into_string()
.unwrap_or("unknown name"
.into())),
}
}
}