1
0
mirror of https://github.com/jht5945/finding.git synced 2025-12-27 21:20:05 +08:00

first commit

This commit is contained in:
2019-07-21 18:34:43 +08:00
parent 2c4907f6d5
commit 0c6ad6a369
2 changed files with 44 additions and 0 deletions

35
src/main.rs Normal file
View File

@@ -0,0 +1,35 @@
extern crate argparse;
extern crate rust_util;
use argparse::{ArgumentParser, StoreTrue, Store};
use rust_util::*;
const VERSION: &str = "0.1";
fn print_version() {
print!(r#"finding {}
Copyright (C) 2019 Hatter Jiang.
License MIT <https://opensource.org/licenses/MIT>
Written by Hatter Jiang
"#, VERSION);
}
fn main() {
let mut version = false;
let mut huge_file_size = String::from("100M");
{
let mut ap = ArgumentParser::new();
ap.set_description("finding - command line find tool.");
ap.refer(&mut huge_file_size).add_option(&["--huge-file"], Store, "Huge file size, default 100M");
ap.refer(&mut version).add_option(&["-v", "--version"], StoreTrue, "Print version");
ap.parse_args_or_exit();
}
if version {
print_version();
return;
}
println!("Hello, world!");
}