feat: v1.10.14, add --no-pin for many subcommands

This commit is contained in:
2024-12-29 11:54:25 +08:00
parent ef1f637c83
commit 5a1942e150
12 changed files with 47 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
use std::{env, fs};
use clap::ArgMatches;
use pinentry::PassphraseInput;
use secrecy::ExposeSecret;
@@ -7,6 +7,15 @@ const PIN_ENTRY_ENV: &str = "PIN_ENTRY_CMD";
const PIN_ENTRY_1: &str = "/usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac";
const PIN_ENTRY_DEFAULT: &str = "pinentry";
pub fn read_pin(sub_arg_matches: &ArgMatches) -> Option<String> {
if sub_arg_matches.is_present("no-pin") {
None
} else {
let pin_opt = sub_arg_matches.value_of("pin");
get_pin(pin_opt)
}
}
pub fn get_pin(pin_opt: Option<&str>) -> Option<String> {
if let Some(pin) = pin_opt {
return Some(pin.to_string());