dashboard / erock/pico / refactor: `--comment` flag is now a bool that reads from stdin for comment #117 rss

open · opened on 2026-02-26T01:37:49Z by erock
Help
checkout latest patchset:
ssh pr.pico.sh print pr-117 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 117
add review to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add --review 117
accept PR:
ssh pr.pico.sh pr accept 117
close PR:
ssh pr.pico.sh pr close 117
Timeline Patchsets
Replaced `--comment` flag which was a string into a bool and now require comment to be provided by stdin for commands `accept`, `close`, and `reopen`.

`echo "lgtm!" | ssh pr.pico.sh pr accept --comment 100`

If no `--comment` flag provided then you don't need to provide stdin.
+9 -2 CHANGELOG.md link
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd0f8b5..4dd2af7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,11 +6,18 @@ Use spec: https://common-changelog.org/
 
 ### Changed
 
-- Upgraded to `go1.25`
-- Removed charm's `wish` with pico's `pssh`
+## v2026-02-25
+
+### Changed
+
+- Replaced `--comment` flag which was a string into a bool and now require comment to be provided by stdin for commands `accept`, `close`, and `reopen`
+  - `echo "lgtm!" | ssh pr.pico.sh pr accept --comment 100`
+  - If no `--comment` flag provided then you don't need to provide stdin
 
 ## v2026-02-24
 
 ### Changed
 
 - Added `ssh {username}@pr register` command and now require explicit registration to use this service
+- Upgraded to `go1.25`
+- Removed charm's `wish` with pico's `pssh`
+35 -9 cli.go link
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
diff --git a/cli.go b/cli.go
index 26f955e..30744c7 100644
--- a/cli.go
+++ b/cli.go
@@ -621,9 +621,9 @@ To get started, submit a new patch request:
 						Args:      true,
 						ArgsUsage: "[prID], [prID]...",
 						Flags: []cli.Flag{
-							&cli.StringFlag{
+							&cli.BoolFlag{
 								Name:  "comment",
-								Usage: "add a comment to the patchset(s)",
+								Usage: "If this flag is provided, pass comment through stdin",
 							},
 						},
 						Action: func(cCtx *cli.Context) error {
@@ -667,7 +667,16 @@ To get started, submit a new patch request:
 									return fmt.Errorf("PR has already been accepted")
 								}
 
-								err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusAccepted, cCtx.String("comment"))
+								comment := cCtx.Bool("comment")
+								var commentTxt []byte
+								if comment {
+									commentTxt, err = io.ReadAll(sesh)
+									if err != nil {
+										return fmt.Errorf("when comment flag enabled must provide it from stdin")
+									}
+								}
+
+								err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusAccepted, string(commentTxt))
 								if err != nil {
 									return err
 								}
@@ -688,9 +697,9 @@ To get started, submit a new patch request:
 						Args:      true,
 						ArgsUsage: "[prID], [prID]...",
 						Flags: []cli.Flag{
-							&cli.StringFlag{
+							&cli.BoolFlag{
 								Name:  "comment",
-								Usage: "add a comment to the patchset(s)",
+								Usage: "If this flag is provided, pass comment through stdin",
 							},
 						},
 						Action: func(cCtx *cli.Context) error {
@@ -739,7 +748,16 @@ To get started, submit a new patch request:
 									return errNotExist(be.Cfg.Host, pubkey)
 								}
 
-								err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusClosed, cCtx.String("comment"))
+								comment := cCtx.Bool("comment")
+								var commentTxt []byte
+								if comment {
+									commentTxt, err = io.ReadAll(sesh)
+									if err != nil {
+										return fmt.Errorf("when comment flag enabled must provide it from stdin")
+									}
+								}
+
+								err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusClosed, string(commentTxt))
 								if err != nil {
 									return err
 								}
@@ -759,9 +777,9 @@ To get started, submit a new patch request:
 						Args:      true,
 						ArgsUsage: "[prID]",
 						Flags: []cli.Flag{
-							&cli.StringFlag{
+							&cli.BoolFlag{
 								Name:  "comment",
-								Usage: "add a comment to the patchset",
+								Usage: "If this flag is provided, pass comment through stdin",
 							},
 						},
 						Action: func(cCtx *cli.Context) error {
@@ -804,7 +822,15 @@ To get started, submit a new patch request:
 								return errNotExist(be.Cfg.Host, pubkey)
 							}
 
-							err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusOpen, cCtx.String("comment"))
+							comment := cCtx.Bool("comment")
+							var commentTxt []byte
+							if comment {
+								commentTxt, err = io.ReadAll(sesh)
+								if err != nil {
+									return fmt.Errorf("when comment flag enabled must provide it from stdin")
+								}
+							}
+							err = pr.UpdatePatchRequestStatus(prID, user.ID, StatusOpen, string(commentTxt))
 							if err == nil {
 								sesh.Printf("Reopened PR %s (#%d)\n", prq.Name, prq.ID)
 							}
+1 -1 e2e_test.go link
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/e2e_test.go b/e2e_test.go
index cad5e1e..b067033 100644
--- a/e2e_test.go
+++ b/e2e_test.go
@@ -121,7 +121,7 @@ func testMultiTenantE2E(t *testing.T) {
 	t.Log("Create pr with admin repo and user can accept with comment")
 	suite.adminKey.MustCmd(nil, "repo create ai")
 	suite.userKey.MustCmd(suite.patch, "pr create admin/ai")
-	suite.adminKey.MustCmd(suite.otherPatch, "pr accept --comment 'nice work' 9")
+	suite.adminKey.MustCmd([]byte("nice work"), "pr accept --comment 9")
 
 	t.Log("Create pr with default `bin` repo")
 	actual, err := suite.userKey.Cmd(suite.patch, "pr create")