dialoguer 0.11
This commit is contained in:
@@ -15,6 +15,7 @@ macro_rules! wlnfl {
|
||||
|
||||
pub enum Error {
|
||||
CustomManagementKey,
|
||||
Dialog(dialoguer::Error),
|
||||
InvalidFlagCommand(String, String),
|
||||
InvalidFlagTui(String),
|
||||
InvalidPinPolicy(String),
|
||||
@@ -35,6 +36,12 @@ pub enum Error {
|
||||
YubiKey(yubikey::Error),
|
||||
}
|
||||
|
||||
impl From<dialoguer::Error> for Error {
|
||||
fn from(e: dialoguer::Error) -> Self {
|
||||
Error::Dialog(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::Error> for Error {
|
||||
fn from(e: io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
@@ -65,6 +72,7 @@ impl fmt::Debug for Error {
|
||||
url = CHANGE_MGMT_KEY_URL
|
||||
)?;
|
||||
}
|
||||
Error::Dialog(e) => wlnfl!(f, "err-io-user", err = e.to_string())?,
|
||||
Error::InvalidFlagCommand(flag, command) => wlnfl!(
|
||||
f,
|
||||
"err-invalid-flag-command",
|
||||
|
||||
+3
-3
@@ -274,10 +274,10 @@ pub(crate) fn disconnect_without_reset(yubikey: YubiKey) {
|
||||
let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard);
|
||||
}
|
||||
|
||||
fn request_pin<E>(
|
||||
mut prompt: impl FnMut(Option<String>) -> io::Result<Result<SecretString, E>>,
|
||||
fn request_pin<E, E2>(
|
||||
mut prompt: impl FnMut(Option<String>) -> Result<Result<SecretString, E>, E2>,
|
||||
serial: Serial,
|
||||
) -> io::Result<Result<SecretString, E>> {
|
||||
) -> Result<Result<SecretString, E>, E2> {
|
||||
let mut prev_error = None;
|
||||
loop {
|
||||
prev_error = Some(match prompt(prev_error)? {
|
||||
|
||||
Reference in New Issue
Block a user