func RunVersion(f *Factory, out io.Writer, cmd *cobra.Command) error { if util.GetFlagBool(cmd, "client") { kubectl.GetClientVersion(out) return nil } client, err := f.Client() if err != nil { return err } kubectl.GetVersion(out, client) return nil }
func NewCmdVersion(out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Print version of client and server", Run: func(cmd *cobra.Command, args []string) { if GetFlagBool(cmd, "client") { kubectl.GetClientVersion(out) } else { kubectl.GetVersion(out, getKubeClient(cmd)) } }, } cmd.Flags().BoolP("client", "c", false, "Client version only (no server required)") return cmd }
func (f *Factory) NewCmdVersion(out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Print version of client and server", Run: func(cmd *cobra.Command, args []string) { if GetFlagBool(cmd, "client") { kubectl.GetClientVersion(out) return } client, err := f.Client(cmd) checkErr(err) kubectl.GetVersion(out, client) }, } cmd.Flags().BoolP("client", "c", false, "Client version only (no server required)") return cmd }