summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_agent
diff options
context:
space:
mode:
Diffstat (limited to 'crates/core/tedge_agent')
-rw-r--r--crates/core/tedge_agent/Cargo.toml2
-rw-r--r--crates/core/tedge_agent/src/main.rs14
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/core/tedge_agent/Cargo.toml b/crates/core/tedge_agent/Cargo.toml
index b36e26f7..30dafb71 100644
--- a/crates/core/tedge_agent/Cargo.toml
+++ b/crates/core/tedge_agent/Cargo.toml
@@ -25,6 +25,7 @@ stop-on-upgrade = false
agent_interface = { path = "../agent_interface" }
anyhow = "1.0"
async-trait = "0.1"
+clap = { version = "3.0", features = ["cargo", "derive"] }
flockfile = { path = "../../common/flockfile" }
futures = "0.3"
mockall = "0.10"
@@ -32,7 +33,6 @@ mqtt_channel = { path = "../../common/mqtt_channel" }
plugin_sm = { path = "../plugin_sm" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-structopt = "0.3"
tedge_config = { path = "../../common/tedge_config" }
tedge_utils = { path = "../../common/tedge_utils", features = ["logging"] }
thiserror = "1.0"
diff --git a/crates/core/tedge_agent/src/main.rs b/crates/core/tedge_agent/src/main.rs
index abe34344..e6492d2c 100644
--- a/crates/core/tedge_agent/src/main.rs
+++ b/crates/core/tedge_agent/src/main.rs
@@ -1,5 +1,5 @@
use agent::SmAgentConfig;
-use structopt::*;
+use clap::Parser;
mod agent;
mod error;
@@ -7,8 +7,8 @@ mod operation_logs;
mod restart_operation_handler;
mod state;
-#[derive(Debug, StructOpt)]
-#[structopt(
+#[derive(Debug, clap::Parser)]
+#[clap(
name = clap::crate_name!(),
version = clap::crate_version!(),
about = clap::crate_description!()
@@ -18,23 +18,23 @@ pub struct AgentOpt {
///
/// If off only reports ERROR, WARN, and INFO
/// If on also reports DEBUG and TRACE
- #[structopt(long)]
+ #[clap(long)]
pub debug: bool,
/// Start the agent with clean session off, subscribe to the topics, so that no messages are lost
- #[structopt(short, long)]
+ #[clap(short, long)]
pub init: bool,
/// Start the agent with clean session on, drop the previous session and subscriptions
///
/// WARNING: All pending messages will be lost.
- #[structopt(short, long)]
+ #[clap(short, long)]
pub clear: bool,
}
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
- let agent_opt = AgentOpt::from_args();
+ let agent_opt = AgentOpt::parse();
tedge_utils::logging::initialise_tracing_subscriber(agent_opt.debug);
let tedge_config_location = tedge_config::TEdgeConfigLocation::from_default_system_location();
let mut agent = agent::SmAgent::try_new(