Make --list{-all} and --identity behave the same way
- Both commands print all slots from all connected YubiKeys by default. - If --serial is specified (without --slot) then print all slots in that YubiKey. - If --slot is specified then then instead print a single slot (requiring --serial if necessary to select a single YubiKey). Closes str4d/age-plugin-yubikey#26.
This commit is contained in:
@@ -12,10 +12,8 @@ pub enum Error {
|
||||
InvalidTouchPolicy(String),
|
||||
Io(io::Error),
|
||||
MultipleCommands,
|
||||
MultipleIdentities,
|
||||
MultipleYubiKeys,
|
||||
NoEmptySlots(Serial),
|
||||
NoIdentities,
|
||||
NoMatchingSerial(Serial),
|
||||
SlotHasNoIdentity(RetiredSlotId),
|
||||
SlotIsNotEmpty(RetiredSlotId),
|
||||
@@ -64,10 +62,6 @@ impl fmt::Debug for Error {
|
||||
f,
|
||||
"Only one of --generate, --identity, --list, --list-all can be specified."
|
||||
)?,
|
||||
Error::MultipleIdentities => writeln!(
|
||||
f,
|
||||
"This YubiKey has multiple age identities. Use --slot to select a single identity."
|
||||
)?,
|
||||
Error::MultipleYubiKeys => writeln!(
|
||||
f,
|
||||
"Multiple YubiKeys are plugged in. Use --serial to select a single YubiKey."
|
||||
@@ -75,9 +69,6 @@ impl fmt::Debug for Error {
|
||||
Error::NoEmptySlots(serial) => {
|
||||
writeln!(f, "YubiKey with serial {} has no empty slots.", serial)?
|
||||
}
|
||||
Error::NoIdentities => {
|
||||
writeln!(f, "This YubiKey does not contain any age identities.")?
|
||||
}
|
||||
Error::NoMatchingSerial(serial) => {
|
||||
writeln!(f, "Could not find YubiKey with serial {}.", serial)?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user