Update to clap 3.* (#4082)

* Update to clap 3.0

This commit migrates all CLI commands internally used in this project
from structopt/clap2 to clap 3. The intent here is to ensure that we're
using maintained versions of the dependencies as structopt and clap 2
are less maintained nowadays. Most transitions were pretty
straightforward and mostly dealing with structopt/clap3 differences.

* Fix a number of `cargo deny` errors

This commit fixes a few errors around duplicate dependencies which
arose from the prior update to clap3. This also uses a new feature in
`deny.toml`, `skip-tree`, which allows having a bit more targeted
ignores for skips of duplicate version checks. This showed a few more
locations in Wasmtime itself where we could update some dependencies.
This commit is contained in:
Alex Crichton
2022-04-28 12:47:12 -05:00
committed by GitHub
parent 871a9d93f2
commit 5fe06f7345
30 changed files with 295 additions and 325 deletions

View File

@@ -8,6 +8,6 @@ publish = false
[dependencies]
cranelift-isle = { version = "*", path = "../isle/" }
env_logger = { version = "0.8", default-features = false }
env_logger = { version = "0.9", default-features = false }
miette = { version = "3.0.0", features = ["fancy"] }
structopt = "0.3.23"
clap = { version = "3.1.12", features = ["derive"] }

View File

@@ -1,3 +1,4 @@
use clap::Parser;
use cranelift_isle::{compile, lexer, parser};
use miette::{Context, IntoDiagnostic, Result};
use std::{
@@ -5,17 +6,16 @@ use std::{
io::{self, Write},
path::PathBuf,
};
use structopt::StructOpt;
#[derive(StructOpt)]
#[derive(Parser)]
struct Opts {
/// The output file to write the generated Rust code to. `stdout` is used if
/// this is not given.
#[structopt(short, long, parse(from_os_str))]
#[clap(short, long)]
output: Option<PathBuf>,
/// The input ISLE DSL source files.
#[structopt(parse(from_os_str), required(true))]
#[clap(required = true)]
inputs: Vec<PathBuf>,
}
@@ -32,7 +32,7 @@ fn main() -> Result<()> {
)
}));
let opts = Opts::from_args();
let opts = Opts::parse();
let lexer = lexer::Lexer::from_files(opts.inputs)?;
let defs = parser::parse(lexer)?;