Implement bd comment alias for bd comments add (bd-d3f0)

- Add commentCmd as top-level alias that delegates to commentsAddCmd
- Add flags for --file and --author to the alias
- Add comprehensive tests in comments_test.go
- Maintain backward compatibility with bd comments add
- Close bd-d3f0
This commit is contained in:
Steve Yegge
2025-11-03 22:23:36 -08:00
parent 4e1e1f361c
commit fc2a9e183e
2 changed files with 93 additions and 0 deletions

View File

@@ -213,11 +213,33 @@ Examples:
},
}
// commentCmd is a top-level alias for commentsAddCmd
var commentCmd = &cobra.Command{
Use: "comment [issue-id] [text]",
Short: "Add a comment to an issue (alias for 'comments add')",
Long: `Add a comment to an issue. This is a convenient alias for 'bd comments add'.
Examples:
# Add a comment
bd comment bd-123 "Working on this now"
# Add a comment from a file
bd comment bd-123 -f notes.txt`,
Args: cobra.MinimumNArgs(1),
Run: commentsAddCmd.Run,
}
func init() {
commentsCmd.AddCommand(commentsAddCmd)
commentsAddCmd.Flags().StringP("file", "f", "", "Read comment text from file")
commentsAddCmd.Flags().StringP("author", "a", "", "Add author to comment")
// Add the same flags to the alias
commentCmd.Flags().StringP("file", "f", "", "Read comment text from file")
commentCmd.Flags().StringP("author", "a", "", "Add author to comment")
rootCmd.AddCommand(commentsCmd)
rootCmd.AddCommand(commentCmd)
}
func isUnknownOperationError(err error) bool {