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:
@@ -1,35 +1,41 @@
|
||||
//! The module that implements the `wasmtime config` command.
|
||||
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
const CONFIG_NEW_AFTER_HELP: &str =
|
||||
"If no file path is specified, the system configuration file path will be used.";
|
||||
|
||||
/// Controls Wasmtime configuration settings
|
||||
#[derive(StructOpt)]
|
||||
#[structopt(name = "run")]
|
||||
pub enum ConfigCommand {
|
||||
#[derive(Parser)]
|
||||
#[clap(name = "config")]
|
||||
pub struct ConfigCommand {
|
||||
#[clap(subcommand)]
|
||||
subcommand: ConfigSubcommand,
|
||||
}
|
||||
|
||||
#[derive(clap::Subcommand)]
|
||||
enum ConfigSubcommand {
|
||||
/// Creates a new Wasmtime configuration file
|
||||
#[structopt(after_help = CONFIG_NEW_AFTER_HELP)]
|
||||
#[clap(after_help = CONFIG_NEW_AFTER_HELP)]
|
||||
New(ConfigNewCommand),
|
||||
}
|
||||
|
||||
impl ConfigCommand {
|
||||
/// Executes the command.
|
||||
pub fn execute(self) -> Result<()> {
|
||||
match self {
|
||||
Self::New(c) => c.execute(),
|
||||
match self.subcommand {
|
||||
ConfigSubcommand::New(c) => c.execute(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new Wasmtime configuration file
|
||||
#[derive(StructOpt)]
|
||||
#[structopt(name = "new", after_help = CONFIG_NEW_AFTER_HELP)]
|
||||
#[derive(Parser)]
|
||||
#[clap(name = "new", after_help = CONFIG_NEW_AFTER_HELP)]
|
||||
pub struct ConfigNewCommand {
|
||||
/// The path of the new configuration file
|
||||
#[structopt(index = 1, value_name = "FILE_PATH")]
|
||||
#[clap(index = 1, value_name = "FILE_PATH")]
|
||||
path: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user