This commit is contained in:
Mr. Funk 2019-05-09 21:20:18 -04:00
parent c0dbffcf0f
commit 6f2f10dbfe
1 changed files with 15 additions and 7 deletions

View File

@ -3,20 +3,28 @@ fn main() {
let app = App::new("sclient") let app = App::new("sclient")
.arg(Arg::with_name("pattern") .arg(Arg::with_name("pattern")
.long("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!"); // println!("Hello, world!");
// //
let matches = app.get_matches(); 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()); println!("{}",matches.value_of("pattern").unwrap());
} }
// cargo run test // cargo run test
// cargo build
// cargo run -- --help
// target/debug/sclient --help // target/debug/sclient --help
// target/debug/sclient --pattern=kevin // target/debug/sclient --pattern=kevin