MCPcopy Create free account
hub / github.com/rilldata/rill / GetCmd

Function GetCmd

cli/cmd/sudo/annotations/get.go:11–46  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

9)
10
11func GetCmd(ch *cmdutil.Helper) *cobra.Command {
12 getCmd := &cobra.Command{
13 Use: "get <org> <project>",
14 Args: cobra.ExactArgs(2),
15 Short: "Get annotations for project in an organization",
16 RunE: func(cmd *cobra.Command, args []string) error {
17 ctx := cmd.Context()
18
19 client, err := ch.Client()
20 if err != nil {
21 return err
22 }
23 res, err := client.GetProject(ctx, &adminv1.GetProjectRequest{
24 Org: args[0],
25 Project: args[1],
26 SuperuserForceAccess: true,
27 })
28 if err != nil {
29 return err
30 }
31
32 if len(res.Project.Annotations) == 0 {
33 ch.PrintfWarn("No annotations found\n")
34 return nil
35 }
36
37 for k, v := range res.Project.Annotations {
38 fmt.Printf("%s=%s\n", k, v)
39 }
40
41 return nil
42 },
43 }
44
45 return getCmd
46}

Callers 1

AnnotationsCmdFunction · 0.70

Calls 5

PrintfWarnMethod · 0.80
PrintfMethod · 0.80
ContextMethod · 0.65
GetProjectMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected