From fcaf5fb14fe562d706e499d31ebed2d7767faf52 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 12 Aug 2025 19:11:13 +0300 Subject: [PATCH] stash: print `--help` text if no subcommand is provided Signed-off-by: NotAShelf Change-Id: I6a6a69646361b7ade52ee73a6aa11be859132a94 --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index dcb600f..7adc780 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,8 @@ use std::{ process, }; +use clap::CommandFactory; + use clap::{Parser, Subcommand}; mod commands; @@ -234,8 +236,11 @@ fn main() { Some(Command::Watch) => { run_daemon(&db, cli.max_dedupe_search, cli.max_items); } - _ => { - log::warn!("No subcommand provided"); + None => { + if let Err(e) = Cli::command().print_help() { + eprintln!("Failed to print help: {e}"); + } + println!(); } } }