コード例 #1
0
ファイル: version.go プロジェクト: vrosnet/kubernetes
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
}
コード例 #2
0
ファイル: version.go プロジェクト: ericcapricorn/kubernetes
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
}
コード例 #3
0
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
}