aboutsummaryrefslogtreecommitdiff
path: root/src/commands.rs
Commit message (Collapse)AuthorAge
* Introduce support for user-provided extensionsDaniel Mueller2020-08-25
| | | | | | | | | | | | | | This change introduces support for discovering and executing user-provided extensions to the program. Extensions are useful for allowing users to provide additional functionality on top of the nitrocli proper. Implementation wise we stick to an approach similar to git or cargo subcommands in nature: we search the directories listed in the PATH environment variable for a file that starts with "nitrocli-", followed by the extension name. This file is then executed. It is assumed that the extension recognizes (or at least not prohibits) the following arguments: --nitrocli (providing the path to the nitrocli binary), --model (with the model passed to the main program), and --verbosity (the verbosity level).
* Rename arg_defs.rs to args.rsDaniel Mueller2020-04-11
| | | | | | We have never been fully satisfied with the name arg_defs. Now that we have gotten rid of the formerly used args module, this change renames arg_defs to args.
* Merge remaining bits of args.rs into main.rsDaniel Mueller2020-04-11
| | | | | | This change removes the args module by moving all remaining functionality in it into main.rs. The result is arguably a nice consolidation of all context related definitions in a single module.
* Merge config_set function into commands.rsDaniel Mueller2020-04-11
| | | | | | As a next step moving us closer towards removing the args module, this change merges the config_set function into the existing function of the same name in the commands module.
* Merge otp_set function into commands.rsDaniel Mueller2020-04-10
| | | | | | | | | Now that we have isolated and separated out structopt specific definitions into a new module, arg_defs, args.rs is actually so small that we do not want to keep it around any longer. This change marks a first step moving us closer towards removing it. Specifically, it merges the otp_set function from args.rs into the function of the same name in commands.rs.
* Move PinType type into arg_defs moduleDaniel Mueller2020-04-02
| | | | | | | | The PinType struct, despite being intended for the pinentry module, is ultimately part of the argument handling definitions. Because our goal is to consolidate all of those in a single file, this change moves the definition of this type from the pinentry module into the newly introduced arg_defs.
* Factor out arg_defs.rs for argument parsing related typesDaniel Mueller2020-04-01
| | | | | | | | This change marks the first step in a restructuring of the argument handling code, the ultimate goal of which is a separation of the type definitions as used by structopt from the logic associated with it. This change in particular introduces a new module, arg_defs, that contains all those type definitions that previously resided in the args module.
* Update nitrokey dependency to 0.6.0Robin Krahl2020-01-29
| | | | | | nitrokey 0.6.0 introduced the SerialNumber struct (instead of representing serial numbers as strings). We no longer have to manually format the serial number as SerialNumber implements Display.
* Implement list commandRobin Krahl2020-01-14
| | | | | | | | | | | | | | | This patch implements the list command that lists all attached Nitrokey devices. Currently the Nitrokey Storage does not report its serial number during HID enumeration, see [0]. So if we detect a Nitrokey Storage device, we connect to it and use the get_serial_number function to query its serial number. This can be disabled using the --no-connect option. Note that even the get_serial_number function reports a wrong serial number for the Nitrokey Storage, see [1]. [0] https://github.com/Nitrokey/nitrokey-storage-firmware/issues/88 [1] https://github.com/Nitrokey/nitrokey-storage-firmware/issues/76
* Add scaffolding for the list commandRobin Krahl2020-01-14
| | | | | This patch adds the basic scaffolding for the list command which will list all attached Nitrokey devices.
* Bump nitrokey dependency to version 0.5.1Robin Krahl2020-01-14
| | | | | | This change updates the version of the nitrokey crate that we use to 0.5.1. As part of that, it replaces occurrences of Storage::get_status with Storage::get_storage_status as the method has been renamed.
* Move nitrocli source code into repository rootDaniel Mueller2020-04-04
Now that all vendored dependencies have been removed, this change moves the program's source code from the nitrocli/ directory into the root of the repository.