From 5dfc79c7562fe63bef0f4a1dc63483304d48a8e3 Mon Sep 17 00:00:00 2001 From: guoxudong Date: Fri, 17 Jan 2020 15:55:42 +0800 Subject: [PATCH] update version cmd --- README.md | 1 + cmd/root.go | 2 +- cmd/version.go | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 89a58650..bf543456 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Available Commands: version Prints the kubecm version Flags: + --config string path of kubeconfig (default "$HOME/.kube/config") -h, --help help for kubecm Use "kubecm [command] --help" for more information about a command. diff --git a/cmd/root.go b/cmd/root.go index 3e7a5a6f..1a7e2177 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -65,7 +65,7 @@ Find more information at: https://github.com/sunny0826/kubecm func (cli *Cli) setFlags() { kubeconfig := flag.String("kubeconfig", filepath.Join(homeDir(), ".kube", "config"), "(optional) absolute path to the kubeconfig file") flags := cli.rootCmd.PersistentFlags() - flags.StringVar(&cfgFile, "config", *kubeconfig, "config.yaml file (default is $HOME/.kubecm.yaml)") + flags.StringVar(&cfgFile, "config", *kubeconfig, "path of kubeconfig") } //Run command diff --git a/cmd/version.go b/cmd/version.go index 3ae63780..23d90543 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -49,9 +49,10 @@ type version struct { func (vc *VersionCommand) Init() { vc.command = &cobra.Command{ - Use: "version", - Short: "Prints the kubecm version", - Example: "kubecm version", + Use: "version", + Short: "Print version info", + Long: "Print version info", + Aliases: []string{"v"}, Run: func(cmd *cobra.Command, args []string) { cmd.Printf("Version: %s\n", getVersion().kubecmVersion) cmd.Printf("GitCommit: %s\n", getVersion().GitCommit)