From d5f42f58d2839c8ea065a8e80cdd7e0bfc21c6cd Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 25 Jun 2024 14:08:54 +0900 Subject: [PATCH] use auto implementation for the version command --- Cargo.lock | 2 +- Cargo.toml | 7 ++----- src/command/mod.rs | 5 +---- src/command/version.rs | 5 ----- 4 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 src/command/version.rs diff --git a/Cargo.lock b/Cargo.lock index e9e0fbe..ba32b47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,7 +520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] -name = "firefish-cli" +name = "fishctl" version = "0.1.0-alpha.1" dependencies = [ "chrono", diff --git a/Cargo.toml b/Cargo.toml index b951e72..1f2c1ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,11 @@ [package] -name = "firefish-cli" +name = "fishctl" +description = "CLI tool for configuring Firefish" version = "0.1.0-alpha.1" rust-version = "1.74" edition = "2021" license = "MIT" -[[bin]] -name = "fishctl" -path = "src/main.rs" - [dependencies] chrono = "0.4" clap = { version = "4.5", features = ["derive"] } diff --git a/src/command/mod.rs b/src/command/mod.rs index 1a4ac41..0c4ecdc 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -2,7 +2,6 @@ mod config; mod generate; -mod version; use clap::{Parser, Subcommand}; @@ -16,6 +15,7 @@ pub(crate) enum Error { } #[derive(Parser)] +#[command(version, about)] struct Args { #[command(subcommand)] command: Commands, @@ -23,8 +23,6 @@ struct Args { #[derive(Subcommand)] enum Commands { - /// Print fishctl version - Version, /// Modify or validate the config files #[command(subcommand)] Config(config::Commands), @@ -37,7 +35,6 @@ pub(super) async fn run() -> Result<(), Error> { let args = Args::parse(); match args.command { - Commands::Version => version::run(), Commands::Config(subcommand) => config::run(subcommand).await?, Commands::Generate(subcommand) => generate::run(subcommand)?, } diff --git a/src/command/version.rs b/src/command/version.rs deleted file mode 100644 index 7fb14d5..0000000 --- a/src/command/version.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! `version` subcommand - -pub(super) fn run() { - println!("v{}", env!("CARGO_PKG_VERSION")); -}