aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/commands.rs b/src/commands.rs
index ff95c31..05038e0 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -61,6 +61,13 @@ fn find_device(config: &config::Config) -> anyhow::Result<nitrokey::DeviceInfo>
let device = iter
.next()
.with_context(|| format!("Nitrokey device not found{}", format_filter(config)))?;
+
+ anyhow::ensure!(
+ iter.next().is_none(),
+ "Multiple Nitrokey devices found{}. Use the --model and --serial-number options to \
+ select one",
+ format_filter(config)
+ );
Ok(device)
}