display error if directory not specified
This commit is contained in:
parent
e22c29ce64
commit
4ff5199285
1 changed files with 7 additions and 1 deletions
|
@ -6,7 +6,13 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let directory = args().nth(1).unwrap();
|
match args().nth(1) {
|
||||||
|
Some(dir) => rename_files_in_directory(dir),
|
||||||
|
None => println!("Please provide a directory"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename_files_in_directory(directory: String) {
|
||||||
println!("Renaming files in {}", directory);
|
println!("Renaming files in {}", directory);
|
||||||
match rename_files(&directory, &directory) {
|
match rename_files(&directory, &directory) {
|
||||||
Ok(count) => println!("Renamed {} files", count),
|
Ok(count) => println!("Renamed {} files", count),
|
||||||
|
|
Loading…
Reference in a new issue