diff options
Diffstat (limited to 'plugins/tedge_apt_plugin')
-rw-r--r-- | plugins/tedge_apt_plugin/Cargo.toml | 2 | ||||
-rw-r--r-- | plugins/tedge_apt_plugin/src/main.rs | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins/tedge_apt_plugin/Cargo.toml b/plugins/tedge_apt_plugin/Cargo.toml index 3a2b9515..28d6a152 100644 --- a/plugins/tedge_apt_plugin/Cargo.toml +++ b/plugins/tedge_apt_plugin/Cargo.toml @@ -15,7 +15,7 @@ assets = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -structopt = "0.3" +clap = { version = "3", features = ["derive"] } thiserror = "1.0" csv = "1.1" serde = { version = "1", features = ["derive"] } diff --git a/plugins/tedge_apt_plugin/src/main.rs b/plugins/tedge_apt_plugin/src/main.rs index 1a0aaa2c..93ded974 100644 --- a/plugins/tedge_apt_plugin/src/main.rs +++ b/plugins/tedge_apt_plugin/src/main.rs @@ -3,18 +3,18 @@ mod module_check; use crate::error::InternalError; use crate::module_check::PackageMetadata; +use clap::Parser; use serde::Deserialize; use std::io::{self}; use std::process::{Command, ExitStatus, Stdio}; -use structopt::StructOpt; -#[derive(StructOpt)] +#[derive(Parser)] struct AptCli { - #[structopt(subcommand)] + #[clap(subcommand)] operation: PluginOp, } -#[derive(StructOpt)] +#[derive(clap::Subcommand)] pub enum PluginOp { /// List all the installed modules List, @@ -22,16 +22,16 @@ pub enum PluginOp { /// Install a module Install { module: String, - #[structopt(short = "v", long = "--module-version")] + #[clap(short = 'v', long = "--module-version")] version: Option<String>, - #[structopt(long = "--file")] + #[clap(long = "--file")] file_path: Option<String>, }, /// Uninstall a module Remove { module: String, - #[structopt(short = "v", long = "--module-version")] + #[clap(short = 'v', long = "--module-version")] version: Option<String>, }, @@ -235,7 +235,7 @@ fn run_cmd(cmd: &str, args: &str) -> Result<ExitStatus, InternalError> { fn main() { // On usage error, the process exits with a status code of 1 - let apt = AptCli::from_args(); + let apt = AptCli::parse(); match run(apt.operation) { Ok(status) if status.success() => { |