mirror of
https://github.com/genuinetools/reg.git
synced 2024-10-03 22:01:45 -04:00
58cebbaa58
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
32 lines
877 B
Go
32 lines
877 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
const versionHelp = `Show the version information.`
|
|
|
|
func (cmd *versionCommand) Name() string { return "version" }
|
|
func (cmd *versionCommand) Args() string { return "" }
|
|
func (cmd *versionCommand) ShortHelp() string { return versionHelp }
|
|
func (cmd *versionCommand) LongHelp() string { return versionHelp }
|
|
func (cmd *versionCommand) Hidden() bool { return false }
|
|
|
|
func (cmd *versionCommand) Register(fs *flag.FlagSet) {}
|
|
|
|
type versionCommand struct{}
|
|
|
|
func (cmd *versionCommand) Run(ctx context.Context, args []string) error {
|
|
fmt.Printf(`%s:
|
|
version : %s
|
|
git hash : %s
|
|
go version : %s
|
|
go compiler : %s
|
|
platform : %s/%s
|
|
`, "ship", ctx.Value(VersionKey).(string), ctx.Value(GitCommitKey).(string),
|
|
runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
|
|
return nil
|
|
}
|