feat: add --pgp --piv check
This commit is contained in:
@@ -13,11 +13,17 @@ impl Command for CommandImpl {
|
|||||||
// .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin"))
|
// .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin"))
|
||||||
// .arg(Arg::with_name("in").short("i").long("in").takes_value(true).help("File in"))
|
// .arg(Arg::with_name("in").short("i").long("in").takes_value(true).help("File in"))
|
||||||
.arg(Arg::with_name("pgp").long("pgp").help("Use PGP"))
|
.arg(Arg::with_name("pgp").long("pgp").help("Use PGP"))
|
||||||
|
.arg(Arg::with_name("piv").long("piv").help("Use PIV"))
|
||||||
.arg(Arg::with_name("sock-file").long("sock-file").default_value("connect.ssh").help("Sock file, usage SSH_AUTH_SOCK=sock-file ssh ..."))
|
.arg(Arg::with_name("sock-file").long("sock-file").default_value("connect.ssh").help("Sock file, usage SSH_AUTH_SOCK=sock-file ssh ..."))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||||
let use_pgp = sub_arg_matches.is_present("pgp");
|
let use_pgp = sub_arg_matches.is_present("pgp");
|
||||||
|
let use_piv = sub_arg_matches.is_present("piv");
|
||||||
|
if !(use_pgp ^ use_piv) {
|
||||||
|
return simple_error!("Args --pgp or --piv must have one selection");
|
||||||
|
}
|
||||||
|
|
||||||
let sock_file = sub_arg_matches.value_of("sock-file").unwrap();
|
let sock_file = sub_arg_matches.value_of("sock-file").unwrap();
|
||||||
information!("Sock file: {}", sock_file);
|
information!("Sock file: {}", sock_file);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user