From f258c313407dfdc752da46d55cf81936e88b6337 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Fri, 13 Feb 2026 16:47:36 -0800 Subject: [PATCH] fix: suppress help output on runtime errors Cobra prints usage/help text by default when `RunE` returns an error. This meant any runtime error (e.g. a rebase conflict during `restack`) would dump a wall of irrelevant help output before the actual error message. Set `SilenceUsage: true` on the root command so help is only shown for actual usage errors. Closes #35 --- cmd/root.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index a82efb2..413e827 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,6 +16,11 @@ var rootCmd = &cobra.Command{ Use: "gh-stack", Short: "Manage stacked pull requests", Long: `gh-stack tracks parent-child relationships between branches, enabling workflows where PRs target other PRs.`, + // SilenceUsage prevents Cobra from printing the help/usage text when a + // command's RunE returns an error. Without this, any runtime error + // (e.g. a rebase conflict) causes the full usage output to be shown, + // which is confusing and unhelpful. + SilenceUsage: true, } // Execute runs the root command.