()
| 46 | } |
| 47 | |
| 48 | func (r *RootCmd) pauseNotifications() *serpent.Command { |
| 49 | cmd := &serpent.Command{ |
| 50 | Use: "pause", |
| 51 | Short: "Pause notifications", |
| 52 | Middleware: serpent.Chain( |
| 53 | serpent.RequireNArgs(0), |
| 54 | ), |
| 55 | Handler: func(inv *serpent.Invocation) error { |
| 56 | client, err := r.InitClient(inv) |
| 57 | if err != nil { |
| 58 | return err |
| 59 | } |
| 60 | |
| 61 | err = client.PutNotificationsSettings(inv.Context(), codersdk.NotificationsSettings{ |
| 62 | NotifierPaused: true, |
| 63 | }) |
| 64 | if err != nil { |
| 65 | return xerrors.Errorf("unable to pause notifications: %w", err) |
| 66 | } |
| 67 | |
| 68 | _, _ = fmt.Fprintln(inv.Stderr, "Notifications are now paused.") |
| 69 | return nil |
| 70 | }, |
| 71 | } |
| 72 | return cmd |
| 73 | } |
| 74 | |
| 75 | func (r *RootCmd) resumeNotifications() *serpent.Command { |
| 76 | cmd := &serpent.Command{ |
no test coverage detected