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

[0.6.0] strange error on update when more the one device are connected. #578

Open
mdc-webdb opened this issue Oct 16, 2024 · 3 comments
Open

Comments

@mdc-webdb
Copy link

mdc-webdb commented Oct 16, 2024

All call of nitropy nk3 update fails with:

nitropy nk3 update
Command line tool to interact with Nitrokey devices 0.6.0
Critical error:
Multiple NK3 devices found -- use the --path option to select one

This line is not very informative, because nitropy nk3 list

nitropy nk3 list
Command line tool to interact with Nitrokey devices 0.6.0
:: 'NK3' keys
/dev/hidraw0: Nitrokey 3 YYYY
/dev/hidraw1: Nitrokey 3 ZZZZ

will show all, but the path option fails on the update command.

nitropy nk3 update --help
Command line tool to interact with Nitrokey devices 0.6.0
Usage: nitropy nk3 update [OPTIONS] [IMAGE]

So the "path" will be the first option. But it will fails with:

nitropy nk3 update --path /dev/hidraw1
Command line tool to interact with Nitrokey devices 0.6.0
Usage: nitropy nk3 update [OPTIONS] [IMAGE]
Try 'nitropy nk3 update -h' for help.

Error: No such option: --path
@robin-nitrokey
Copy link
Member

The following command should work:

$ nitropy nk3 --path /dev/hidraw1 update

I understand that this can be very confusing. AFAIK this is a limitation of the CLI framework we use because the --path option is defined for all Nitrokey 3 commands. I don’t know a way to make nitropy nk3 update --path /dev/hidraw1 work without manually duplicating the option for all commands. But at least we could update the error message with an example invocation that shows the correct call.

@robin-nitrokey
Copy link
Member

Here’s the upstream issue: pallets/click#66. There is no intention to change the behavior. We could try to work around it as described here: https://stackoverflow.com/questions/32493912/is-it-possible-to-add-a-global-argument-for-all-subcommands-in-click-based-inter

@mdc-webdb
Copy link
Author

Hi @robin-nitrokey,
I think an better message with an example in the error message will be the best.
Because here the code change will be very simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants