Skip to content

Commit 9db599c

Browse files
robinkrahld-e-s-o
authored andcommitted
Migrate to clap v3.0.0
This patch replaces structopt with clap v3.0.0.
1 parent 5735b53 commit 9db599c

File tree

7 files changed

+165
-121
lines changed

7 files changed

+165
-121
lines changed

Cargo.lock

Lines changed: 82 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ default-run = "nitrocli"
2424
[[bin]]
2525
name = "shell-complete"
2626
path = "var/shell-complete.rs"
27+
required-features = ["clap_generate"]
2728

2829
[[bin]]
2930
name = "nitrocli-otp-cache"
@@ -45,6 +46,15 @@ version = "1.0"
4546
[dependencies.base32]
4647
version = "0.5.1"
4748

49+
[dependencies.clap]
50+
version = "3.0"
51+
default-features = false
52+
features = ["derive", "std", "unicode"]
53+
54+
[dependencies.clap_generate]
55+
version = "3.0"
56+
optional = true
57+
4858
[dependencies.directories]
4959
version = "5"
5060

@@ -67,10 +77,6 @@ version = "3.0.2"
6777
version = "1.0.156"
6878
features = ["derive"]
6979

70-
[dependencies.structopt]
71-
version = "0.3.21"
72-
default-features = false
73-
7480
[dependencies.termion]
7581
version = "1.5.5"
7682

ext/otp_cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::io::Write as _;
88
use std::path;
99

1010
use anyhow::Context as _;
11-
use structopt::StructOpt as _;
11+
use clap::StructOpt as _;
1212

1313
mod ext;
1414

@@ -33,7 +33,7 @@ struct Slot {
3333
/// `--force-update` option is set. The cache includes the Nitrokey's
3434
/// serial number so that it is possible to use it with multiple
3535
/// devices.
36-
#[derive(Debug, structopt::StructOpt)]
36+
#[derive(Debug, clap::StructOpt)]
3737
#[structopt(bin_name = "nitrocli otp-cache")]
3838
struct Args {
3939
/// Always query the slot data even if it is already cached
@@ -43,7 +43,7 @@ struct Args {
4343
cmd: Command,
4444
}
4545

46-
#[derive(Debug, structopt::StructOpt)]
46+
#[derive(Debug, clap::StructOpt)]
4747
enum Command {
4848
/// Generates a one-time password
4949
Get {

src/arg_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ macro_rules! Command {
2222
$( $(#[$doc:meta])* $var:ident$(($inner:ty))? => $exec:expr, ) *
2323
] ) => {
2424
$(#[$docs])*
25-
#[derive(Debug, PartialEq, structopt::StructOpt)]
25+
#[derive(Debug, PartialEq, clap::StructOpt)]
2626
pub enum $name {
2727
$(
2828
$(#[$doc])*

0 commit comments

Comments
 (0)