From 6f2f10dbfedeeade8dfd675f39f2c286b9e3fe75 Mon Sep 17 00:00:00 2001 From: "Mr. Funk" Date: Thu, 9 May 2019 21:20:18 -0400 Subject: [PATCH] init cli --- src/main.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index f9e064a..82edba1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,20 +3,28 @@ fn main() { let app = App::new("sclient") .arg(Arg::with_name("pattern") .long("pattern") - .takes_value(true)); + .takes_value(true) + .required(true) + ) + .arg(Arg::with_name("servername") + .long("servername") + .takes_value(true) + .required(true) + ) + .arg(Arg::with_name("k") + .short("k") + .takes_value(true) + .required(true) + ); // println!("Hello, world!"); // let matches = app.get_matches(); - // let pattern = std::env::args().nth(1).expect("no pattern given"); - // let path = std::env::args().nth(2).expect("no path given"); - // let args = Cli { - // pattern: pattern, - // //path: std::path::PathBuf::from(path), - // }; println!("{}",matches.value_of("pattern").unwrap()); } // cargo run test +// cargo build +// cargo run -- --help // target/debug/sclient --help // target/debug/sclient --pattern=kevin