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