blob: fb9b7ebd983dbb743abdc7048c9a9ed98b7bb44f [file] [log] [blame]
Serge Bazanskibe538db2020-11-12 00:22:42 +01001// Copyright 2017 The kubecfg authors
2//
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package cmd
17
18import (
19 "fmt"
20
21 jsonnet "github.com/google/go-jsonnet"
22 "github.com/spf13/cobra"
23 "k8s.io/client-go/pkg/version"
24)
25
26func init() {
27 RootCmd.AddCommand(versionCmd)
28}
29
30// Version is overridden by main
31var Version = "(dev build)"
32
33var versionCmd = &cobra.Command{
34 Use: "version",
35 Short: "Print version information",
36 Args: cobra.NoArgs,
37 Run: func(cmd *cobra.Command, args []string) {
38 out := cmd.OutOrStdout()
39 fmt.Fprintln(out, "kubecfg version:", Version)
40 fmt.Fprintln(out, "jsonnet version:", jsonnet.Version())
41 fmt.Fprintln(out, "client-go version:", version.Get())
42 },
43}