Skip to content

Commit aa3677a

Browse files
committed
Move from structopt to clap
structopt has been succeeded by clap and won't be updated anymore
1 parent b1a6fa3 commit aa3677a

File tree

3 files changed

+195
-49
lines changed

3 files changed

+195
-49
lines changed

Cargo.lock

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

dbc-codegen-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ homepage = "https://github.com/technocreatives/dbc-codegen"
1515

1616
[dependencies]
1717
heck = "0.4.0"
18-
structopt = "0.3.26"
18+
clap = { version = "4.1", features = ["derive"] }
1919
exitcode = "1.1.2"
2020
dbc-codegen = { version = "0.2", path = ".." }
2121

dbc-codegen-cli/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
use clap::Parser;
12
use std::fs::File;
23
use std::{path::PathBuf, process::exit};
3-
use structopt::StructOpt;
44

55
/// Generate Rust `struct`s from a `dbc` file.
6-
#[derive(Debug, StructOpt)]
6+
#[derive(Debug, Parser)]
7+
#[command(version)]
78
struct Cli {
89
/// Path to a `.dbc` file
910
dbc_path: PathBuf,
1011
/// Target directory to write Rust source file(s) to
1112
out_path: PathBuf,
1213
/// Enable debug printing
13-
#[structopt(long)]
14+
#[arg(long)]
1415
debug: bool,
1516
}
1617

1718
fn main() {
18-
let args = Cli::from_args();
19+
let args = Cli::parse();
1920
let dbc_file = std::fs::read(&args.dbc_path).unwrap_or_else(|e| {
2021
eprintln!("could not read `{}`: {}", args.dbc_path.display(), e);
2122
exit(exitcode::NOINPUT);

0 commit comments

Comments
 (0)