sclient.rust/src/main.rs

44 lines
1.1 KiB
Rust
Raw Normal View History

2019-05-10 01:14:19 +00:00
use clap::*;
2019-05-10 00:39:01 +00:00
fn main() {
2019-05-10 01:14:19 +00:00
let app = App::new("sclient")
2019-05-10 02:44:34 +00:00
.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) // remove if t/f
.required(true),
);
// println!("Hello, world!");
//
let matches = app.get_matches();
println!("{}", matches.value_of("pattern").unwrap());
2019-05-10 00:39:01 +00:00
}
2019-05-10 01:07:22 +00:00
// cargo run test
2019-05-10 01:20:18 +00:00
// cargo build
// cargo run -- --help
2019-05-10 01:14:19 +00:00
// target/debug/sclient --help
// target/debug/sclient --pattern=kevin
2019-05-10 01:07:22 +00:00
struct Cli {
2019-05-10 02:44:34 +00:00
pattern: String,
path: std::path::PathBuf,
2019-05-10 01:07:22 +00:00
}
// insecure := flag.Bool("k", false, "ignore bad TLS/SSL/HTTPS certificates")
// servername := flag.String("servername", "", "specify a servername different from <remote> (to disable SNI use an IP as <remote> and do use this option)")
// flag.BoolVar(insecure, "insecure", false, "ignore bad TLS/SSL/HTTPS certificates")
// flag.Parse()
// remotestr := flag.Arg(0)
// localstr := flag.Arg(1)