version: add message_type in --json mode
This commit is contained in:
parent
33c670dd7a
commit
2d250a9135
1 changed files with 10 additions and 8 deletions
|
@ -25,6 +25,7 @@ Exit status is 1 if there was any error.
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
if globalOptions.JSON {
|
if globalOptions.JSON {
|
||||||
type jsonVersion struct {
|
type jsonVersion struct {
|
||||||
|
MessageType string `json:"message_type"` // version
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
GoVersion string `json:"go_version"`
|
GoVersion string `json:"go_version"`
|
||||||
GoOS string `json:"go_os"`
|
GoOS string `json:"go_os"`
|
||||||
|
@ -32,6 +33,7 @@ Exit status is 1 if there was any error.
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonS := jsonVersion{
|
jsonS := jsonVersion{
|
||||||
|
MessageType: "version",
|
||||||
Version: version,
|
Version: version,
|
||||||
GoVersion: runtime.Version(),
|
GoVersion: runtime.Version(),
|
||||||
GoOS: runtime.GOOS,
|
GoOS: runtime.GOOS,
|
||||||
|
|
Loading…
Add table
Reference in a new issue