use auto implementation for the version command

This commit is contained in:
naskya 2024-06-25 14:08:54 +09:00
parent 3493eeb29e
commit d5f42f58d2
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
4 changed files with 4 additions and 15 deletions

2
Cargo.lock generated
View file

@ -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",

View file

@ -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"] }

View file

@ -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)?,
}

View file

@ -1,5 +0,0 @@
//! `version` subcommand
pub(super) fn run() {
println!("v{}", env!("CARGO_PKG_VERSION"));
}