Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Improve CLI by showing help when no subcommand given
Maximilian Roos905b978b3177
diff --git a/src/cli.rs b/src/cli.rsindex 18eab21e9..8122e4677 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -95,6 +95,7 @@ pub enum OutputFormat {#[command(version = version_str())]#[command(disable_help_subcommand = true)]#[command(styles = help_styles())]+#[command(arg_required_else_help = true)]#[command(after_long_help = r#"See `wt config --help` for configuration file locations and setup."#)]@@ -134,7 +135,7 @@ pub struct Cli {pub internal: bool,#[command(subcommand)]- pub command: Commands,+ pub command: Option<Commands>,}#[derive(Subcommand)]diff --git a/src/main.rs b/src/main.rsindex 6dc9e46eb..8e827ec7c 100644--- a/src/main.rs+++ b/src/main.rs@@ -212,7 +212,15 @@ fn main() {}).init();- let result = match cli.command {+ let Some(command) = cli.command else {+ // No subcommand provided - print help to stderr (stdout is eval'd by shell wrapper)+ let mut cmd = cli::build_command();+ let help = cmd.render_help().ansi().to_string();+ eprintln!("{help}");+ return;+ };++ let result = match command {Commands::Config { action } => match action {ConfigCommand::Shell { action } => {match action {