mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 13:23:09 +01:00
Add CLI to interact with Diun through gRPC (#382)
Add simple CLI to interact with Diun through gRPC Create image and notif proto services Compile and validate protos through a dedicated Dockerfile and bake target Implement proto definitions Move server as `serve` command New commands `image` and `notif` Refactor command line usage doc Better CLI error handling Tools build constraint to manage tools deps through go modules Add upgrade notes Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
30
cmd/notif.go
Normal file
30
cmd/notif.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/crazy-max/diun/v4/pb"
|
||||
)
|
||||
|
||||
// NotifCmd holds notif command
|
||||
type NotifCmd struct {
|
||||
Test NotifTestCmd `kong:"cmd,help='Test notification settings.'"`
|
||||
}
|
||||
|
||||
// NotifTestCmd holds notif test command
|
||||
type NotifTestCmd struct {
|
||||
CliGlobals
|
||||
}
|
||||
|
||||
func (s *NotifTestCmd) Run(ctx *Context) error {
|
||||
defer s.conn.Close()
|
||||
|
||||
nt, err := s.notifSvc.NotifTest(context.Background(), &pb.NotifTestRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(nt.Message)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user