blob: 7644fb9976fda9958c27bb2700ea3a06a9ea46e7 [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"
Serge Bazanskibe538db2020-11-12 00:22:42 +010023)
24
25func init() {
26 RootCmd.AddCommand(versionCmd)
27}
28
29// Version is overridden by main
Serge Bazanski64033612020-11-12 00:36:50 +010030var Version = "unknown (external)"
Serge Bazanskibe538db2020-11-12 00:22:42 +010031
32var versionCmd = &cobra.Command{
33 Use: "version",
34 Short: "Print version information",
35 Args: cobra.NoArgs,
36 Run: func(cmd *cobra.Command, args []string) {
37 out := cmd.OutOrStdout()
Serge Bazanski64033612020-11-12 00:36:50 +010038 fmt.Fprintln(out, "kartongips, a fork of github.com/bitnami/kubecfg")
39 fmt.Fprintln(out, "hscloud version:", Version)
Serge Bazanskibe538db2020-11-12 00:22:42 +010040 fmt.Fprintln(out, "jsonnet version:", jsonnet.Version())
Serge Bazanskibe538db2020-11-12 00:22:42 +010041 },
42}