From 003ed28b37e49551b2bc6d8d4e992138198d3326 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Tue, 26 Apr 2022 00:48:55 +0800 Subject: [PATCH] feat: add --pgp --piv check --- src/cmd_sshagent.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cmd_sshagent.rs b/src/cmd_sshagent.rs index b98fda3..5b095d0 100644 --- a/src/cmd_sshagent.rs +++ b/src/cmd_sshagent.rs @@ -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("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("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 ...")) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { 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(); information!("Sock file: {}", sock_file);