Add basic logic
This commit is contained in:
parent
7ef1d69c49
commit
60842d8fe3
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Czkawka
|
||||
Czkawka is simple and easy to use alternative to Fslint written in Rust.
|
||||
It is in very early development, so most of the functions aren't added and doesn't work.
|
||||
|
||||
|
||||
## Done
|
||||
- Nothing now
|
||||
|
||||
## TODO
|
||||
- Graphical UI(GTK)
|
||||
- Duplicated file finding
|
||||
- Setting include and exclude directories(Regex support needed)
|
||||
- Removing empty folders
|
||||
- Files with debug symbols
|
||||
|
||||
## License
|
||||
Czkawka is released under the terms of the GNU Lesser General Public License, version 2.1 or, at your option, any later version, as published by the Free Software Foundation.
|
41
src/main.rs
41
src/main.rs
|
@ -1,5 +1,42 @@
|
|||
mod duplicate_finder;
|
||||
use std::{env, process};
|
||||
|
||||
mod duplicate;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
// Parse argument
|
||||
//
|
||||
let arguments: Vec<String> = env::args().collect();
|
||||
println!("Number of arguments - {}", arguments.len());
|
||||
|
||||
for (index, argument) in arguments.iter().enumerate() {
|
||||
println!("Argument number {} - {}", index, argument);
|
||||
}
|
||||
if arguments.len() == 1 {
|
||||
print_help();
|
||||
process::exit(0);
|
||||
}
|
||||
match arguments[1].as_ref() {
|
||||
"-d" | "-duplicate_finder" => {
|
||||
if arguments.len() != 4 {
|
||||
println!("Duplicate Finder must be executed with exactly 3 arguments");
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
let mut df = duplicate::DuplicateFinder::new();
|
||||
df.set_include_directory(arguments[2].to_string());
|
||||
df.set_exclude_directory(arguments[3].to_string());
|
||||
}
|
||||
argum => println!("{} argument is not supported, check help for more info.", argum),
|
||||
};
|
||||
}
|
||||
|
||||
fn print_help() {
|
||||
println!();
|
||||
println!("Usage of Czkawka:");
|
||||
println!("# Arguments:");
|
||||
println!(" -h - prints help, also works without any arguments");
|
||||
println!(" -help");
|
||||
println!(" -d \"include,include2\" \"exclude,exclude2\" [--delete] - search for duplicate files in `include` directories separated by comma inside qutes and exclue selected files from search");
|
||||
println!(" -duplicate_finder");
|
||||
println!();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue