From f6fab3afadf7b936a30533e0a71cad4bb60cc8a4 Mon Sep 17 00:00:00 2001 From: dag Date: Wed, 21 Jan 2026 17:30:04 -0800 Subject: [PATCH] feat(cmd): add --comment as alias for --reason in gt close Add support for --comment flag as an alias for --reason in the gt close command. This provides a more intuitive option name for users who think of close messages as comments rather than reasons. Handles both --comment value and --comment=value forms. Co-Authored-By: Claude Opus 4.5 --- internal/cmd/close.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/cmd/close.go b/internal/cmd/close.go index 17ba0831..068ac9ce 100644 --- a/internal/cmd/close.go +++ b/internal/cmd/close.go @@ -3,6 +3,7 @@ package cmd import ( "os" "os/exec" + "strings" "github.com/spf13/cobra" ) @@ -20,6 +21,7 @@ Examples: gt close gt-abc # Close bead gt-abc gt close gt-abc gt-def # Close multiple beads gt close --reason "Done" # Close with reason + gt close --comment "Done" # Same as --reason (alias) gt close --force # Force close pinned beads`, DisableFlagParsing: true, // Pass all flags through to bd close RunE: runClose, @@ -30,8 +32,20 @@ func init() { } func runClose(cmd *cobra.Command, args []string) error { + // Convert --comment to --reason (alias support) + convertedArgs := make([]string, len(args)) + for i, arg := range args { + if arg == "--comment" { + convertedArgs[i] = "--reason" + } else if strings.HasPrefix(arg, "--comment=") { + convertedArgs[i] = "--reason=" + strings.TrimPrefix(arg, "--comment=") + } else { + convertedArgs[i] = arg + } + } + // Build bd close command with all args passed through - bdArgs := append([]string{"close"}, args...) + bdArgs := append([]string{"close"}, convertedArgs...) bdCmd := exec.Command("bd", bdArgs...) bdCmd.Stdin = os.Stdin bdCmd.Stdout = os.Stdout