(cmd *cobra.Command, _ []string, flags versionFlags)
| 52 | } |
| 53 | |
| 54 | func versionCmdFunc(cmd *cobra.Command, _ []string, flags versionFlags) error { |
| 55 | w := cmd.OutOrStdout() |
| 56 | info := getVersionInfo() |
| 57 | if flags.verbose { |
| 58 | fmt.Fprintf(w, "Version: %v\n", info.Version) |
| 59 | fmt.Fprintf(w, "Platform: %v\n", info.Platform) |
| 60 | fmt.Fprintf(w, "Commit: %v\n", info.Commit) |
| 61 | fmt.Fprintf(w, "Commit Time: %v\n", info.CommitDate) |
| 62 | fmt.Fprintf(w, "Go Version: %v\n", info.GoVersion) |
| 63 | fmt.Fprintf(w, "Launcher: %v\n", info.LauncherVersion) |
| 64 | |
| 65 | } else { |
| 66 | fmt.Fprintf(w, "%v\n", info.Version) |
| 67 | } |
| 68 | return nil |
| 69 | } |
| 70 | |
| 71 | type versionInfo struct { |
| 72 | Version string |
no test coverage detected