MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / NewVersionCmd

Function NewVersionCmd

app/cli/cmd/version.go:52–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52func NewVersionCmd() *cobra.Command {
53 return &cobra.Command{
54 Use: "version",
55 Short: "Command line version",
56 RunE: func(_ *cobra.Command, _ []string) error {
57 var version = struct {
58 Client string `json:"client"`
59 Server string `json:"server"`
60 }{
61 Client: Version,
62 Server: "unknown",
63 }
64
65 if ActionOpts.CPConnection != nil {
66 res, err := pb.NewStatusServiceClient(ActionOpts.CPConnection).Infoz(context.Background(), &pb.InfozRequest{})
67 if err == nil {
68 version.Server = res.Version
69 }
70 }
71
72 if flagOutputFormat == output.FormatJSON {
73 return output.EncodeJSON(version)
74 }
75
76 fmt.Printf("Client Version: %s\n", version.Client)
77 fmt.Printf("Server Version: %s\n", version.Server)
78
79 return nil
80 },
81 }
82}
83
84func executableInfo() (*info, error) {
85 h, err := executableDigest()

Callers 1

NewRootCmdFunction · 0.85

Calls 2

EncodeJSONFunction · 0.92
InfozMethod · 0.65

Tested by

no test coverage detected