fix(comments): preserve unquoted multi-word text (#5192)

This commit is contained in:
Kushida 2026-07-31 20:18:23 +03:00 • committed by GitHub
commit 6356dce01b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View file

@ -193,7 +193,7 @@ func TestProxiedServerComment(t *testing.T) {
p := newSharedProxiedProject(t, bd, "aj")
issue := bdProxiedCreate(t, bd, p.dir, "Add JSON")
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "comments", "add", issue.ID, "add json body", "--json")
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "comments", "add", issue.ID, "add", "json", "body", "--json")
if err != nil {
t.Fatalf("comments add --json failed: %v\nstderr:\n%s", err, stderr)
}

View file

@ -164,7 +164,7 @@ See: bd comments --help`)
}
var commentsAddCmd = &cobra.Command{
Use: "add [issue-id] [text]",
Use: "add [issue-id] [text...]",
Short: "Add a comment to an issue",
Long: `Add a comment to an issue.
@ -203,7 +203,7 @@ Examples:
} else if len(args) < 2 {
return HandleErrorRespectJSON("comment text required (use -f to read from file)")
} else {
commentText = args[1]
commentText = strings.Join(args[1:], " ")
}
if strings.TrimSpace(commentText) == "" {

View file

@ -48,7 +48,7 @@ func TestEmbeddedCommentsCLI(t *testing.T) {
t.Run("comments_add_json", func(t *testing.T) {
issue := bdCreate(t, bd, dir, "JSON comment", "--type", "task")
cmd := exec.Command(bd, "comments", "add", issue.ID, "JSON comment text", "--json")
cmd := exec.Command(bd, "comments", "add", issue.ID, "JSON", "comment", "text", "--json")
cmd.Dir = dir
cmd.Env = bdEnv(dir)
stdout, stderr, err := runCommandBuffers(t, cmd)

View file

@ -127,7 +127,7 @@ func runCommentsAddProxiedServer(cmd *cobra.Command, ctx context.Context, args [
} else if len(args) < 2 {
return HandleErrorRespectJSON("comment text required (use -f to read from file)")
} else {
commentText = args[1]
commentText = strings.Join(args[1:], " ")
}
if strings.TrimSpace(commentText) == "" {