diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-01-10 08:49:09 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-02-18 15:41:57 +0100 |
commit | df052450ba30e55b5dcd464bca5236e1e995a2b9 (patch) | |
tree | 11ec5465c22459808055744582b6554d9f4bc624 /crates/core/tedge/src/cli/mod.rs | |
parent | ee2a1c14f338fe5e433d4d58a862994d60fb18f7 (diff) |
Replace structopt with clap 3
This patch rewrites the CLI interfaces to be used with clap 3.0 instead
of clap 2.x + structopt.
The changes are as minimal as possible, although I did not verify that
the CLI is the same as before.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/core/tedge/src/cli/mod.rs')
-rw-r--r-- | crates/core/tedge/src/cli/mod.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/core/tedge/src/cli/mod.rs b/crates/core/tedge/src/cli/mod.rs index d54dacee..236b718f 100644 --- a/crates/core/tedge/src/cli/mod.rs +++ b/crates/core/tedge/src/cli/mod.rs @@ -1,6 +1,5 @@ use crate::command::{BuildCommand, BuildContext, Command}; -use structopt::clap; -use structopt::StructOpt; +use clap; mod certificate; mod config; @@ -8,32 +7,37 @@ mod connect; mod disconnect; mod mqtt; -#[derive(StructOpt, Debug)] -#[structopt( +#[derive(clap::Parser, Debug)] +#[clap( name = clap::crate_name!(), version = clap::crate_version!(), about = clap::crate_description!() )] pub struct Opt { - #[structopt(subcommand)] + #[clap(subcommand)] pub tedge: TEdgeOpt, } -#[derive(StructOpt, Debug)] +#[derive(clap::Subcommand, Debug)] pub enum TEdgeOpt { /// Create and manage device certificate + #[clap(subcommand)] Cert(certificate::TEdgeCertCli), /// Configure Thin Edge. + #[clap(subcommand)] Config(config::ConfigCmd), /// Connect to connector provider + #[clap(subcommand)] Connect(connect::TEdgeConnectOpt), /// Remove bridge connection for a provider + #[clap(subcommand)] Disconnect(disconnect::TEdgeDisconnectBridgeCli), /// Publish a message on a topic and subscribe a topic. + #[clap(subcommand)] Mqtt(mqtt::TEdgeMqttCli), } |