Commit aa02c5e909

aa02c5e909d34aeb6e7f9e314530495ceab29b3e

parent: 8eb3623130

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-24 00:45 UTC

notifications device add: verb first

Ref #254
internal/control/notifications.go +1 −1
@@ -279,7 +279,7 @@ func runNotificationsDeviceAdd(c *Ctx, args []string) int {
279279 return c.fail(protocol.ExitFailure, "%v", err)
280280 }
281281 return c.emit(map[string]any{"id": id, "status": "registered"}, func(w io.Writer) {
282 fmt.Fprintf(w, "device %d registered\n", id)
282 fmt.Fprintf(w, "registered device %d\n", id)
283283 })
284284}
285285
internal/control/notifications_test.go +13
@@ -243,6 +243,19 @@ func TestNotificationsDeviceAddReturnsTheID(t *testing.T) {
243243 }
244244}
245245
246func TestNotificationsDeviceAddPlainSaysRegisteredDevice(t *testing.T) {
247 c := notifTestCtx(t, "alice")
248 c.Stdin = strings.NewReader("DEVTOKEN\n")
249 var out bytes.Buffer
250 c.Stdout, c.JSON = &out, false
251 if code := runNotificationsDeviceAdd(c, nil); code != 0 {
252 t.Fatalf("exit %d", code)
253 }
254 if got := out.String(); !strings.HasPrefix(got, "registered device ") {
255 t.Errorf("device add printed %q", got)
256 }
257}
258
246259func TestNotificationsSettingsShowsPush(t *testing.T) {
247260 c := notifTestCtx(t, "alice")
248261 var out bytes.Buffer