reg/vendor/github.com/genuinetools/pkg/cli/version.go
Jess Frazelle 0301f323b3
update to use generated files for assets
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-09-17 15:23:04 -04:00

33 lines
898 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
`, ctx.Value(NameKey).(string), ctx.Value(VersionKey).(string), ctx.Value(GitCommitKey).(string),
runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
return nil
}