Сравнить коммиты

...

2 Коммитов

Автор SHA1 Сообщение Дата
Mr. Funk e72c895b07 init cli 2019-05-09 21:20:18 -04:00
Mr. Funk 554971b0f4 cli 2019-05-09 21:14:19 -04:00
2 изменённых файлов: 26 добавлений и 9 удалений

Просмотреть файл

@ -5,3 +5,4 @@ authors = ["lastlink <theefunk@gmail.com>"]
edition = "2018"
[dependencies]
clap = "*"

Просмотреть файл

@ -1,16 +1,32 @@
use clap::*;
fn main() {
println!("Hello, world!");
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!("{}",args.pattern)
let app = App::new("sclient")
.arg(Arg::with_name("pattern")
.long("pattern")
.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();
println!("{}",matches.value_of("pattern").unwrap());
}
// cargo run test
// cargo build
// cargo run -- --help
// target/debug/sclient --help
// target/debug/sclient --pattern=kevin
struct Cli {
pattern: String,