()
| 100 | } |
| 101 | |
| 102 | func (r *RootCmd) testNotifications() *serpent.Command { |
| 103 | cmd := &serpent.Command{ |
| 104 | Use: "test", |
| 105 | Short: "Send a test notification", |
| 106 | Middleware: serpent.Chain( |
| 107 | serpent.RequireNArgs(0), |
| 108 | ), |
| 109 | Handler: func(inv *serpent.Invocation) error { |
| 110 | client, err := r.InitClient(inv) |
| 111 | if err != nil { |
| 112 | return err |
| 113 | } |
| 114 | |
| 115 | if err := client.PostTestNotification(inv.Context()); err != nil { |
| 116 | return xerrors.Errorf("unable to post test notification: %w", err) |
| 117 | } |
| 118 | |
| 119 | _, _ = fmt.Fprintln(inv.Stderr, "A test notification has been sent. If you don't receive the notification, check Coder's logs for any errors.") |
| 120 | return nil |
| 121 | }, |
| 122 | } |
| 123 | return cmd |
| 124 | } |
| 125 | |
| 126 | func (r *RootCmd) customNotifications() *serpent.Command { |
| 127 | cmd := &serpent.Command{ |
no test coverage detected