MCPcopy
hub / github.com/cilium/cilium / New

Function New

hubble/cmd/version/version.go:16–32  ·  view source on GitHub ↗

New version command.

()

Source from the content-addressed store, hash-verified

14
15// New version command.
16func New() *cobra.Command {
17 return &cobra.Command{
18 Use: "version",
19 Short: "Display detailed version information",
20 Long: `Displays information about the version of this software.`,
21 Run: func(cmd *cobra.Command, _ []string) {
22 var gitInfo string
23 switch {
24 case pkg.GitBranch != "" && pkg.GitHash != "":
25 gitInfo = fmt.Sprintf("@%s-%s", pkg.GitBranch, pkg.GitHash)
26 case pkg.GitHash != "":
27 gitInfo = fmt.Sprintf("@%s", pkg.GitHash)
28 }
29 fmt.Printf("%s %s%s compiled with %v on %v/%v\n", cmd.Root().Name(), pkg.Version, gitInfo, runtime.Version(), runtime.GOOS, runtime.GOARCH)
30 },
31 }
32}

Callers 1

NewWithViperFunction · 0.92

Calls 2

NameMethod · 0.65
VersionMethod · 0.65

Tested by

no test coverage detected