Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --usb-path option to select device #122

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! Add --usb-path option to select device
typos
  • Loading branch information
robinkrahl committed Sep 9, 2020
commit 616a55b6ecd4fa8bd85ce2af6a6d53860be8a9ec
2 changes: 1 addition & 1 deletion doc/nitrocli.1
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Restrict connections to the given serial numbers (list of strings, default:
empty, see \fB\-\-serial-number\fR).
.TP
.B usb_path
Restruict connections to the given USB path (string, default: not set, see
Restrict connections to the given USB path (string, default: not set, see
\fB\-\-usb-path\fR).
.TP
.B no_cache
Expand Down
Binary file modified doc/nitrocli.1.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn find_device(config: &config::Config) -> anyhow::Result<nitrokey::DeviceInfo>

anyhow::ensure!(
iter.next().is_none(),
"Multiple Nitrokey devices found{}. Use the --model, --serial-number and --usb-path options \
"Multiple Nitrokey devices found{}. Use the --model, --serial-number, and --usb-path options \
to select one",
format_filter(config)
);
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Config {
#[merge(strategy = merge::vec::overwrite_empty)]
#[serde(default, deserialize_with = "deserialize_serial_number_vec")]
pub serial_numbers: Vec<nitrokey::SerialNumber>,
/// The usb path of the device to connect to.
/// The USB path of the device to connect to.
pub usb_path: Option<String>,
/// Whether to bypass the cache for all secrets or not.
#[merge(strategy = merge::bool::overwrite_false)]
Expand Down
4 changes: 2 additions & 2 deletions src/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn connect_multiple(_model: nitrokey::Model) -> anyhow::Result<()> {
let err = res.unwrap_err().to_string();
assert_eq!(
err,
"Multiple Nitrokey devices found. Use the --model, --serial-number and --usb-path options to select one"
"Multiple Nitrokey devices found. Use the --model, --serial-number, and --usb-path options to select one"
);
}
Ok(())
Expand Down Expand Up @@ -193,7 +193,7 @@ fn connect_model(_model: nitrokey::Model) -> anyhow::Result<()> {
format!(
"Multiple Nitrokey devices found (filter: model={}). ",
model.to_lowercase()
) + "Use the --model, --serial-number and --usb-path options to select one"
) + "Use the --model, --serial-number, and --usb-path options to select one"
);
}
}
Expand Down