feat: updates
This commit is contained in:
33
src/cmdutil.rs
Normal file
33
src/cmdutil.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
use clap::{Arg, ArgMatches};
|
||||
use rust_util::util_msg;
|
||||
|
||||
pub fn build_slot_arg() -> Arg<'static, 'static> {
|
||||
Arg::with_name("slot")
|
||||
.short("s")
|
||||
.long("slot")
|
||||
.takes_value(true)
|
||||
.help("PIV slot, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e")
|
||||
}
|
||||
|
||||
pub fn build_pin_arg() -> Arg<'static, 'static> {
|
||||
Arg::with_name("pin").short("p").long("pin").takes_value(true).help("PIV card user PIN")
|
||||
}
|
||||
|
||||
pub fn build_keychain_name_arg() -> Arg<'static, 'static> {
|
||||
Arg::with_name("keychain-name")
|
||||
.long("keychain-name")
|
||||
.takes_value(true)
|
||||
.help("Key chain name")
|
||||
}
|
||||
|
||||
pub fn build_json_arg() -> Arg<'static, 'static> {
|
||||
Arg::with_name("json").long("json").help("JSON output")
|
||||
}
|
||||
|
||||
pub fn check_json_output(sub_arg_matches: &ArgMatches) -> bool {
|
||||
let json_output = sub_arg_matches.is_present("json");
|
||||
if json_output {
|
||||
util_msg::set_logger_std_out(false);
|
||||
}
|
||||
json_output
|
||||
}
|
||||
Reference in New Issue
Block a user