From a330fb9e5682f165902f42aceb47b0c0e2239640 Mon Sep 17 00:00:00 2001 From: sjquant Date: Fri, 6 Sep 2024 13:03:16 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Print=20help=20message=20when=20?= =?UTF-8?q?no=20subcommand=20provided?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index c7f3f32..879ef3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use std::path::Path; -use clap::Parser; +use clap::{IntoApp, Parser}; use flopha::cli::{Cli, Commands}; use flopha::service::{last_version, next_version}; @@ -14,10 +14,12 @@ fn main() { Some(Commands::NextVersion(args)) => { next_version(path, args); } - None => {} - } - - if cli.version { - println!("{}", env!("CARGO_PKG_VERSION")); + None => { + if cli.version { + println!("{}", env!("CARGO_PKG_VERSION")); + } else { + Cli::command().print_help().unwrap(); + } + } } }