dialoguer 0.11
This commit is contained in:
Generated
+3
-2
@@ -499,12 +499,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dialoguer"
|
name = "dialoguer"
|
||||||
version = "0.10.4"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87"
|
checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console",
|
"console",
|
||||||
"shell-words",
|
"shell-words",
|
||||||
|
"thiserror",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ age-plugin = "0.5"
|
|||||||
base64 = "0.21"
|
base64 = "0.21"
|
||||||
bech32 = "0.9"
|
bech32 = "0.9"
|
||||||
console = { version = "0.15", default-features = false }
|
console = { version = "0.15", default-features = false }
|
||||||
dialoguer = { version = "0.10", default-features = false, features = ["password"] }
|
dialoguer = { version = "0.11", default-features = false, features = ["password"] }
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
gumdrop = "0.8"
|
gumdrop = "0.8"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ err-invalid-flag-tui = Flag '{$flag}' cannot be used with the interactive in
|
|||||||
err-invalid-pin-policy = Invalid PIN policy '{$policy}' (expected [{$expected}]).
|
err-invalid-pin-policy = Invalid PIN policy '{$policy}' (expected [{$expected}]).
|
||||||
err-invalid-slot = Invalid slot '{$slot}' (expected number between 1 and 20).
|
err-invalid-slot = Invalid slot '{$slot}' (expected number between 1 and 20).
|
||||||
err-invalid-touch-policy = Invalid touch policy '{$policy}' (expected [{$expected}]).
|
err-invalid-touch-policy = Invalid touch policy '{$policy}' (expected [{$expected}]).
|
||||||
|
err-io-user = Failed to get input from user: {$err}
|
||||||
err-io = Failed to set up {-yubikey}: {$err}
|
err-io = Failed to set up {-yubikey}: {$err}
|
||||||
err-multiple-commands = Only one of {-cmd-generate}, {-cmd-identity}, {-cmd-list}, {-cmd-list-all} can be specified.
|
err-multiple-commands = Only one of {-cmd-generate}, {-cmd-identity}, {-cmd-list}, {-cmd-list-all} can be specified.
|
||||||
err-multiple-yubikeys = Multiple {-yubikeys} are plugged in. Use {-flag-serial} to select a single {-yubikey}.
|
err-multiple-yubikeys = Multiple {-yubikeys} are plugged in. Use {-flag-serial} to select a single {-yubikey}.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ macro_rules! wlnfl {
|
|||||||
|
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
CustomManagementKey,
|
CustomManagementKey,
|
||||||
|
Dialog(dialoguer::Error),
|
||||||
InvalidFlagCommand(String, String),
|
InvalidFlagCommand(String, String),
|
||||||
InvalidFlagTui(String),
|
InvalidFlagTui(String),
|
||||||
InvalidPinPolicy(String),
|
InvalidPinPolicy(String),
|
||||||
@@ -35,6 +36,12 @@ pub enum Error {
|
|||||||
YubiKey(yubikey::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 {
|
impl From<io::Error> for Error {
|
||||||
fn from(e: io::Error) -> Self {
|
fn from(e: io::Error) -> Self {
|
||||||
Error::Io(e)
|
Error::Io(e)
|
||||||
@@ -65,6 +72,7 @@ impl fmt::Debug for Error {
|
|||||||
url = CHANGE_MGMT_KEY_URL
|
url = CHANGE_MGMT_KEY_URL
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
Error::Dialog(e) => wlnfl!(f, "err-io-user", err = e.to_string())?,
|
||||||
Error::InvalidFlagCommand(flag, command) => wlnfl!(
|
Error::InvalidFlagCommand(flag, command) => wlnfl!(
|
||||||
f,
|
f,
|
||||||
"err-invalid-flag-command",
|
"err-invalid-flag-command",
|
||||||
|
|||||||
+3
-3
@@ -274,10 +274,10 @@ pub(crate) fn disconnect_without_reset(yubikey: YubiKey) {
|
|||||||
let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard);
|
let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request_pin<E>(
|
fn request_pin<E, E2>(
|
||||||
mut prompt: impl FnMut(Option<String>) -> io::Result<Result<SecretString, E>>,
|
mut prompt: impl FnMut(Option<String>) -> Result<Result<SecretString, E>, E2>,
|
||||||
serial: Serial,
|
serial: Serial,
|
||||||
) -> io::Result<Result<SecretString, E>> {
|
) -> Result<Result<SecretString, E>, E2> {
|
||||||
let mut prev_error = None;
|
let mut prev_error = None;
|
||||||
loop {
|
loop {
|
||||||
prev_error = Some(match prompt(prev_error)? {
|
prev_error = Some(match prompt(prev_error)? {
|
||||||
|
|||||||
Reference in New Issue
Block a user