From c0d268ba63da4b32c378f29850b6bdad396394cb Mon Sep 17 00:00:00 2001 From: Xinzhao Xu Date: Tue, 12 Dec 2023 10:32:47 +0800 Subject: [PATCH] wacker-cli: unify clap attributes and remove unnecessary ones --- wacker-cli/src/commands/delete.rs | 3 +-- wacker-cli/src/commands/list.rs | 3 +-- wacker-cli/src/commands/logs.rs | 3 +-- wacker-cli/src/commands/restart.rs | 3 +-- wacker-cli/src/commands/run.rs | 3 +-- wacker-cli/src/commands/stop.rs | 3 +-- wacker-cli/src/main.rs | 15 +++++++++------ 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/wacker-cli/src/commands/delete.rs b/wacker-cli/src/commands/delete.rs index c221c8a..018374b 100644 --- a/wacker-cli/src/commands/delete.rs +++ b/wacker-cli/src/commands/delete.rs @@ -3,8 +3,7 @@ use clap::Parser; use tonic::transport::Channel; use wacker_api::{modules_client::ModulesClient, DeleteRequest}; -#[derive(Parser, PartialEq)] -#[structopt(name = "delete", aliases = &["rm"])] +#[derive(Parser)] pub struct DeleteCommand { /// Module ID #[arg(required = true)] diff --git a/wacker-cli/src/commands/list.rs b/wacker-cli/src/commands/list.rs index 231fab7..a9d3997 100644 --- a/wacker-cli/src/commands/list.rs +++ b/wacker-cli/src/commands/list.rs @@ -7,8 +7,7 @@ use tabled::{ use tonic::transport::Channel; use wacker_api::{modules_client::ModulesClient, ModuleStatus}; -#[derive(Parser, PartialEq)] -#[structopt(name = "list", aliases = &["ps"])] +#[derive(Parser)] pub struct ListCommand {} #[derive(Tabled)] diff --git a/wacker-cli/src/commands/logs.rs b/wacker-cli/src/commands/logs.rs index eb668fa..b176ecb 100644 --- a/wacker-cli/src/commands/logs.rs +++ b/wacker-cli/src/commands/logs.rs @@ -4,8 +4,7 @@ use std::process::Command; use tonic::transport::Channel; use wacker_api::config::LOGS_DIR; -#[derive(Parser, PartialEq)] -#[structopt(name = "logs", aliases = &["log"])] +#[derive(Parser)] pub struct LogsCommand { /// Module ID #[arg(required = true)] diff --git a/wacker-cli/src/commands/restart.rs b/wacker-cli/src/commands/restart.rs index b32cea9..37c3595 100644 --- a/wacker-cli/src/commands/restart.rs +++ b/wacker-cli/src/commands/restart.rs @@ -3,8 +3,7 @@ use clap::Parser; use tonic::transport::Channel; use wacker_api::{modules_client::ModulesClient, RestartRequest}; -#[derive(Parser, PartialEq)] -#[structopt(name = "restart")] +#[derive(Parser)] pub struct RestartCommand { /// Module ID #[arg(required = true)] diff --git a/wacker-cli/src/commands/run.rs b/wacker-cli/src/commands/run.rs index 39951dc..75c26da 100644 --- a/wacker-cli/src/commands/run.rs +++ b/wacker-cli/src/commands/run.rs @@ -3,8 +3,7 @@ use clap::Parser; use tonic::transport::Channel; use wacker_api::{modules_client::ModulesClient, RunRequest}; -#[derive(Parser, PartialEq)] -#[structopt(name = "run")] +#[derive(Parser)] pub struct RunCommand { /// Module file path #[arg(required = true)] diff --git a/wacker-cli/src/commands/stop.rs b/wacker-cli/src/commands/stop.rs index 9e6763e..b923c98 100644 --- a/wacker-cli/src/commands/stop.rs +++ b/wacker-cli/src/commands/stop.rs @@ -3,8 +3,7 @@ use clap::Parser; use tonic::transport::Channel; use wacker_api::{modules_client::ModulesClient, StopRequest}; -#[derive(Parser, PartialEq)] -#[structopt(name = "stop")] +#[derive(Parser)] pub struct StopCommand { /// Module ID #[arg(required = true)] diff --git a/wacker-cli/src/main.rs b/wacker-cli/src/main.rs index 7672303..e096327 100644 --- a/wacker-cli/src/main.rs +++ b/wacker-cli/src/main.rs @@ -11,23 +11,26 @@ use wacker_api::config::SOCK_PATH; #[command(name = "wacker")] #[command(author, version, about, long_about = None)] struct Wacker { - #[clap(subcommand)] + #[command(subcommand)] subcommand: Subcommand, } -#[derive(Parser, PartialEq)] +#[derive(Parser)] enum Subcommand { /// Runs a WebAssembly module Run(commands::RunCommand), - /// List running WebAssembly modules + /// Lists running WebAssembly modules + #[command(visible_alias = "ps")] List(commands::ListCommand), /// Stops a WebAssembly module Stop(commands::StopCommand), - /// Restart a WebAssembly module + /// Restarts a WebAssembly module Restart(commands::RestartCommand), - /// Delete a WebAssembly module + /// Deletes a WebAssembly module + #[command(visible_alias = "rm")] Delete(commands::DeleteCommand), - /// Fetch the logs of a module + /// Fetches logs of a module + #[command(visible_alias = "log")] Logs(commands::LogsCommand), }