// SPDX-FileCopyrightText: 2025 - 2026 Frederic Ruget <fred@atlant.is> (GitHub: @douzebis)
//// SPDX-License-Identifier: MIT
useanyhow::Result;useclap::Args;useyb_core::{errors::{explain_pcsc, PcscCode},
open_backend,};#[derive(Args, Debug)]pubstructListReadersArgs{}/// Run list-readers without constructing a Context (works when no YubiKey is connected).
pubfnrun(_args:&ListReadersArgs)->Result<()>{let readers =open_backend()?.list_readers()?;if readers.is_empty(){// Same explanation as "no YubiKey found" elsewhere (spec 0025 ยง4);
// still exit 0, as before.
eprintln!("No PC/SC readers found.");ifletSome(fix)=explain_pcsc(&PcscCode::NoReaders).and_then(|e|e.fix){eprintln!(" Try: {fix}.");}}else{for r in&readers {println!("{r}");}}Ok(())}