| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
This patch updates the nitrokey dependency to version 0.8.0 and applies
all breaking changes (Config fields renaming, DeviceWrapper and Model
non-exhaustiveness, changed Display implementation for Model).
|
|
|
|
|
|
|
|
| |
With this change we switch to using a REUSE compliant way of specifying
the copyright & license of the program. To be fully in conformance we
also add additional license specifications for the remaining files in
the project. Lastly, a new CI pipeline rule takes care of verifying
compliance on an ongoing basis.
|
|
|
|
|
| |
This change adjusts the copyright header in all files to no longer
mention individuals but refer to The Nitrocli Developers in general.
|
|
|
|
|
|
|
| |
Since we moved the model, no_cache and verbosity fields from ExecCtx
into Config and added a Config field to both ExecCtx and RunCtx, RunCtx
and ExecCtx are identical. Therefore this patch merges the ExecCtx and
RunCtx structs into the new Context struct.
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes our error handling approach from the ground up:
instead of having a globally used Error enum that contains variants for
all possible errors, we now use anyhow's Error type. This approach is
more dynamic (and not statically typed), but it allows for more fine
grained error messages and overall more user-friendly error reporting.
Overall it also is a net simplification. While we have one dynamic cast
now, in order to be able to handle erroneous password/PIN entries
correctly, that is considered a reasonable compromise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our custom macros for conveniently creating types with additional meta
information for working with structopt do not actually use the doc
comments we have in place -- these comments are solely for in-source
documentation. We are an application and as such crates.io will not
automatically generate documentation.
All of that does not deter rustc from complaining that doc comments are
unused. In the past we tried to fudge that by adding a special
allowance, #[allow(unused_doc_comments)], but that seems to have seized
to work.
With this change we finally give in and move the doc comment into the
macro itself, where it will be used to annotate the generated type. This
step should hopefully silence rustc once and for all -- at the expense
of a slight decrease in readability.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
With the recent patch set moving us to using structopt over argparse we
introduced all new structs and enums representing subcommands and the
like as public. That is unnecessary, as they are not accessed from the
outside.
This change adjusts the visibility accordingly.
|
|
|
|
|
|
|
|
| |
This patch introduces two changes to the Command! macro:
- We allow variants without fields so that we no longer have to define
empty *Args structs just for the Command! macro.
- We allow doc comments so that we can document commands without a
separate *Args struct.
|
|
|
|
|
|
|
|
|
| |
To make it easier to list all possible values for a command-line option
mapped to an enum, we add the all_str function to the Enum! macro that
returns an array of the string representations of all variants.
We also use this new function to simplify the generation of the error
message in the FromStr implementation in Enum!.
|
|
|
|
|
|
|
| |
As we no longer have to implement the Display and AsRef traits for the
enums generated with the Command! macro, we don’t have to set a string
representation either. So we can drop this argument from the Command!
macro.
|
|
|
|
|
|
| |
In the previous patches, we replaced argparse with structopt and removed
the argparse dependency. This patch removes the code that was only
needed for argparse.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes the argument handling code to use structopt instead
of argparse using the data structures we introduced in the last patch.
As part of that transition we replace the old Error::ArgparseError
variant with ClapError that stores a structopt::clap::Error.
Because of that replacement, the format of the help messages changed,
breaking some of the tests. Hence, this change adapts them accordingly.
Also clap currently prints the version output to stdout, so we ignore
the version_option test case for now.
|
|
|
|
|
|
| |
As a preparation for the structopt transition, we derive StructOpt for
the enums generated by Command! so that they can be used as a
subcommand.
|
|
|
|
|
|
|
| |
For the transition to structopt, we have to be able to easily construct
enum variants once we have added fields to them. Therefore we implement
the Default trait in the generated macros by choosing the first variant
as the default.
|
|
|
|
|
|
| |
To be able to use the enums generated by Command! with structopt, we
have to be able to add fields to them. This patch adds a new variant to
the Command! macro that supports fields.
|
|
|
|
|
| |
For easier refactoring, we remove the internal enum_int! macro and
instead copy its code to the Enum! and Command! macros.
|
|
|
|
|
|
|
|
|
| |
In one of the next patches, we will add fields to some Command variants
to be able to use them with structopt. Then we will no longer be able
to instantiate them directly, so we replace these instances for the
transition.
This patch also removes the cmd_help! macro that is no longer needed.
|
|
|
|
|
| |
structopt requires that FromStr::Err implements std::fmt::Display.
Therefore we now return a String that contains a list of allowed values.
|
|
|
|
|
|
| |
For an easier transition to structopt, this patch splits the two cases
of the Enum! macro into two separate macros (that internally both call
the new enum_int! macro).
|
|
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.
|