refactor to move kubectl.cmd.Factory to kubect/cmd/util

This commit is contained in:
deads2k
2015-04-07 14:21:25 -04:00
parent 13b805fe1e
commit 6344cf3c3a
34 changed files with 664 additions and 611 deletions

View File

@@ -22,24 +22,24 @@ import (
"github.com/spf13/cobra"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
cmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
)
func (f *Factory) NewCmdVersion(out io.Writer) *cobra.Command {
func NewCmdVersion(f *cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the client and server version information.",
Run: func(cmd *cobra.Command, args []string) {
err := RunVersion(f, out, cmd)
util.CheckErr(err)
cmdutil.CheckErr(err)
},
}
cmd.Flags().BoolP("client", "c", false, "Client version only (no server required).")
return cmd
}
func RunVersion(f *Factory, out io.Writer, cmd *cobra.Command) error {
if util.GetFlagBool(cmd, "client") {
func RunVersion(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
if cmdutil.GetFlagBool(cmd, "client") {
kubectl.GetClientVersion(out)
return nil
}