MCPcopy Index your code
hub / github.com/coder/coder / testNotifications

Method testNotifications

cli/notifications.go:102–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100}
101
102func (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
126func (r *RootCmd) customNotifications() *serpent.Command {
127 cmd := &serpent.Command{

Callers 1

notificationsMethod · 0.95

Calls 4

InitClientMethod · 0.95
PostTestNotificationMethod · 0.80
ContextMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected