summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge/src/cli
diff options
context:
space:
mode:
Diffstat (limited to 'crates/core/tedge/src/cli')
-rw-r--r--crates/core/tedge/src/cli/certificate/cli.rs10
-rw-r--r--crates/core/tedge/src/cli/config/cli.rs7
-rw-r--r--crates/core/tedge/src/cli/connect/cli.rs7
-rw-r--r--crates/core/tedge/src/cli/disconnect/cli.rs3
-rw-r--r--crates/core/tedge/src/cli/mod.rs16
-rw-r--r--crates/core/tedge/src/cli/mqtt/cli.rs11
6 files changed, 27 insertions, 27 deletions
diff --git a/crates/core/tedge/src/cli/certificate/cli.rs b/crates/core/tedge/src/cli/certificate/cli.rs
index 7ef78fb5..a3e9db64 100644
--- a/crates/core/tedge/src/cli/certificate/cli.rs
+++ b/crates/core/tedge/src/cli/certificate/cli.rs
@@ -3,15 +3,14 @@ use super::{create::CreateCertCmd, remove::RemoveCertCmd, show::ShowCertCmd, upl
use crate::command::{BuildCommand, BuildContext, Command};
use crate::ConfigError;
-use structopt::StructOpt;
use tedge_config::*;
-#[derive(StructOpt, Debug)]
+#[derive(clap::Subcommand, Debug)]
pub enum TEdgeCertCli {
/// Create a self-signed device certificate
Create {
/// The device identifier to be used as the common name for the certificate
- #[structopt(long = "device-id")]
+ #[clap(long = "device-id")]
id: String,
},
@@ -22,6 +21,7 @@ pub enum TEdgeCertCli {
Remove,
/// Upload root certificate
+ #[clap(subcommand)]
Upload(UploadCertCli),
}
@@ -73,13 +73,13 @@ impl BuildCommand for TEdgeCertCli {
}
}
-#[derive(StructOpt, Debug)]
+#[derive(clap::Subcommand, Debug)]
pub enum UploadCertCli {
/// Upload root certificate to Cumulocity
///
/// The command will upload root certificate to Cumulocity.
C8y {
- #[structopt(long = "user")]
+ #[clap(long = "user")]
/// Provided username should be a Cumulocity user with tenant management permissions.
/// The password is requested on /dev/tty, unless the $C8YPASS env var is set to the user password.
username: String,
diff --git a/crates/core/tedge/src/cli/config/cli.rs b/crates/core/tedge/src/cli/config/cli.rs
index bfe2caa4..dff15e47 100644
--- a/crates/core/tedge/src/cli/config/cli.rs
+++ b/crates/core/tedge/src/cli/config/cli.rs
@@ -1,10 +1,9 @@
use crate::cli::config::{commands::*, config_key::*};
use crate::command::*;
use crate::ConfigError;
-use structopt::StructOpt;
use tedge_config::ConfigRepository;
-#[derive(StructOpt, Debug)]
+#[derive(clap::Subcommand, Debug)]
pub enum ConfigCmd {
/// Get the value of the provided configuration key
Get {
@@ -30,11 +29,11 @@ pub enum ConfigCmd {
/// Print the configuration keys and their values
List {
/// Prints all the configuration keys, even those without a configured value
- #[structopt(long = "all")]
+ #[clap(long = "all")]
is_all: bool,
/// Prints all keys and descriptions with example values
- #[structopt(long = "doc")]
+ #[clap(long = "doc")]
is_doc: bool,
},
}
diff --git a/crates/core/tedge/src/cli/connect/cli.rs b/crates/core/tedge/src/cli/connect/cli.rs
index 64a351f4..654af945 100644
--- a/crates/core/tedge/src/cli/connect/cli.rs
+++ b/crates/core/tedge/src/cli/connect/cli.rs
@@ -1,16 +1,15 @@
use crate::cli::connect::*;
use crate::command::{BuildCommand, BuildContext, Command};
use crate::system_services::service_manager;
-use structopt::StructOpt;
-#[derive(StructOpt, Debug, PartialEq)]
+#[derive(clap::Subcommand, Debug, PartialEq)]
pub enum TEdgeConnectOpt {
/// Create connection to Cumulocity
///
/// The command will create config and start edge relay from the device to c8y instance
C8y {
/// Test connection to Cumulocity
- #[structopt(long = "test")]
+ #[clap(long = "test")]
is_test_connection: bool,
},
@@ -19,7 +18,7 @@ pub enum TEdgeConnectOpt {
/// The command will create config and start edge relay from the device to az instance
Az {
/// Test connection to Azure
- #[structopt(long = "test")]
+ #[clap(long = "test")]
is_test_connection: bool,
},
}
diff --git a/crates/core/tedge/src/cli/disconnect/cli.rs b/crates/core/tedge/src/cli/disconnect/cli.rs
index 1b77aff6..e13a9250 100644
--- a/crates/core/tedge/src/cli/disconnect/cli.rs
+++ b/crates/core/tedge/src/cli/disconnect/cli.rs
@@ -1,12 +1,11 @@
use crate::cli::disconnect::disconnect_bridge::*;
use crate::command::*;
use crate::system_services::service_manager;
-use structopt::StructOpt;
const C8Y_CONFIG_FILENAME: &str = "c8y-bridge.conf";
const AZURE_CONFIG_FILENAME: &str = "az-bridge.conf";
-#[derive(StructOpt, Debug)]
+#[derive(clap::Subcommand, Debug)]
pub enum TEdgeDisconnectBridgeCli {
/// Remove bridge connection to Cumulocity.
C8y,
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),
}
diff --git a/crates/core/tedge/src/cli/mqtt/cli.rs b/crates/core/tedge/src/cli/mqtt/cli.rs
index 32f4906f..f6878a78 100644
--- a/crates/core/tedge/src/cli/mqtt/cli.rs
+++ b/crates/core/tedge/src/cli/mqtt/cli.rs
@@ -2,7 +2,6 @@ use crate::cli::mqtt::{publish::MqttPublishCommand, subscribe::MqttSubscribeComm
use crate::command::{BuildCommand, BuildContext, Command};
use rumqttc::QoS;
use std::time::Duration;
-use structopt::StructOpt;
use tedge_config::*;
const DEFAULT_HOST: &str = "localhost";
@@ -10,7 +9,7 @@ const PUB_CLIENT_PREFIX: &str = "tedge-pub";
const SUB_CLIENT_PREFIX: &str = "tedge-sub";
const DISCONNECT_TIMEOUT: Duration = Duration::from_secs(2);
-#[derive(StructOpt, Debug)]
+#[derive(clap::Subcommand, Debug)]
pub enum TEdgeMqttCli {
/// Publish a MQTT message on a topic.
Pub {
@@ -19,10 +18,10 @@ pub enum TEdgeMqttCli {
/// Message to publish
message: String,
/// QoS level (0, 1, 2)
- #[structopt(short, long, parse(try_from_str = parse_qos), default_value = "0")]
+ #[clap(short, long, parse(try_from_str = parse_qos), default_value = "0")]
qos: QoS,
/// Retain flag
- #[structopt(short, long = "retain")]
+ #[clap(short, long = "retain")]
retain: bool,
},
@@ -31,10 +30,10 @@ pub enum TEdgeMqttCli {
/// Topic to subscribe to
topic: String,
/// QoS level (0, 1, 2)
- #[structopt(short, long, parse(try_from_str = parse_qos), default_value = "0")]
+ #[clap(short, long, parse(try_from_str = parse_qos), default_value = "0")]
qos: QoS,
/// Avoid printing the message topics on the console
- #[structopt(long = "no-topic")]
+ #[clap(long = "no-topic")]
hide_topic: bool,
},
}