@@ -34,9 +34,8 @@ var versionExample = templates.Examples(`
3434
3535// Options is a struct to support version command.
3636type Options struct {
37- ClientOnly bool
38- Short bool
39- Output string
37+ Short bool
38+ Output string
4039
4140 genericiooptions.IOStreams
4241}
@@ -53,8 +52,8 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cob
5352 o := NewOptions (ioStreams )
5453 cmd := & cobra.Command {
5554 Use : "version" ,
56- Short : "Print the client and server version information" ,
57- Long : "Print the client and server version information for the current context" ,
55+ Short : "Print the client version information" ,
56+ Long : "Print the client version information for the current context" ,
5857 Example : versionExample ,
5958 Run : func (cmd * cobra.Command , args []string ) {
6059 cmdutil .CheckErr (o .Complete (f , cmd ))
@@ -63,7 +62,6 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cob
6362 },
6463 }
6564
66- cmd .Flags ().BoolVar (& o .ClientOnly , "client" , o .ClientOnly , "If true, shows client version only (no server required)." )
6765 cmd .Flags ().StringVarP (& o .Output , "output" , "o" , o .Output , "One of 'yaml' or 'json'." )
6866 cmd .Flags ().BoolVar (& o .Short , "short" , o .Short , "If true, print just the version number." )
6967
@@ -99,9 +97,9 @@ func (o *Options) Run() error {
9997 switch o .Output {
10098 case "" :
10199 if o .Short {
102- fmt .Fprintf (o .Out , "Client Version: %s\n " , clientVersion .GitVersion )
100+ fmt .Fprintf (o .Out , "%s\n " , clientVersion .String () )
103101 } else {
104- fmt .Fprintf (o .Out , "Client Version: %s\n " , fmt . Sprintf ( "%#v" , clientVersion ))
102+ fmt .Fprintf (o .Out , "Client Version: %s\n " , clientVersion . ToJSON ( ))
105103 }
106104 case "yaml" :
107105 marshaled , err := yaml .Marshal (& versionInfo )
0 commit comments