|
| 1 | +package cli |
| 2 | + |
| 3 | +import "github.com/coder/serpent" |
| 4 | + |
| 5 | +func (r *RootCmd) notifications() *serpent.Command { |
| 6 | + cmd := &serpent.Command{ |
| 7 | + Use: "notifications", |
| 8 | + Short: "Manage Coder notifications", |
| 9 | + Long: "Administrators can use these commands to change notification settings.\n" + FormatExamples( |
| 10 | + Example{ |
| 11 | + Description: "Pause Coder notifications", |
| 12 | + Command: "coder notifications pause", |
| 13 | + }, |
| 14 | + Example{ |
| 15 | + Description: "Unpause Coder notifications", |
| 16 | + Command: "coder notifications unpause", |
| 17 | + }, |
| 18 | + ), |
| 19 | + Aliases: []string{"notification"} |
| 20 | + Handler: func(inv *serpent.Invocation) error { |
| 21 | + return inv.Command.HelpHandler(inv) |
| 22 | + }, |
| 23 | + Children: []*serpent.Command{ |
| 24 | + |
| 25 | + }, |
| 26 | + } |
| 27 | + return cmd |
| 28 | +} |
| 29 | + |
| 30 | +func (r *RootCmd) pauseNotifications() *serpent.Command { |
| 31 | + client := new(codersdk.Client) |
| 32 | + cmd := &serpent.Command{ |
| 33 | + Use: "pause", |
| 34 | + Short: "Pause notifications", |
| 35 | + Middleware: serpent.Chain( |
| 36 | + serpent.RequireNArgs(0), |
| 37 | + r.InitClient(client), |
| 38 | + ), |
| 39 | + Handler: func(inv *serpent.Invocation) error { |
| 40 | + return nil |
| 41 | + }, |
| 42 | + } |
| 43 | + return cmd |
| 44 | +} |
| 45 | + |
| 46 | +func (r *RootCmd) unpauseNotifications() *serpent.Command { |
| 47 | + client := new(codersdk.Client) |
| 48 | + cmd := &serpent.Command{ |
| 49 | + Use: "unpause", |
| 50 | + Short: "Unpause notifications", |
| 51 | + Middleware: serpent.Chain( |
| 52 | + serpent.RequireNArgs(0), |
| 53 | + r.InitClient(client), |
| 54 | + ), |
| 55 | + Handler: func(inv *serpent.Invocation) error { |
| 56 | + return nil |
| 57 | + }, |
| 58 | + } |
| 59 | + return cmd |
| 60 | +} |
0 commit comments