-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcommand.go
More file actions
39 lines (33 loc) · 890 Bytes
/
command.go
File metadata and controls
39 lines (33 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package hive
import (
"log/slog"
"os"
"github.com/spf13/cobra"
)
// Command constructs the cobra command for hive. The hive
// command can be used to inspect the dependency graph.
func (h *Hive) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "hive",
Short: "Inspect the hive",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
return h.PrintObjects(os.Stdout, slog.Default())
},
TraverseChildren: false,
}
h.RegisterFlags(cmd.PersistentFlags())
cmd.AddCommand(
&cobra.Command{
Use: "dot-graph",
Short: "Output the dependencies graph in graphviz dot format",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
return h.PrintDotGraph()
},
TraverseChildren: false,
})
return cmd
}