40 lines
835 B
Go
40 lines
835 B
Go
package version
|
|
|
|
import (
|
|
"context"
|
|
"downloadhub/pkg/constants"
|
|
"flag"
|
|
"fmt"
|
|
"runtime"
|
|
|
|
"github.com/google/subcommands"
|
|
)
|
|
|
|
type (
|
|
VersionCmd struct {
|
|
}
|
|
)
|
|
|
|
func (*VersionCmd) Name() string { return "version" }
|
|
func (*VersionCmd) Synopsis() string { return "show version and system information" }
|
|
func (*VersionCmd) Usage() string {
|
|
return `Usage: ./cli version
|
|
|
|
Print the version of the software
|
|
|
|
Options:
|
|
`
|
|
}
|
|
|
|
func (p *VersionCmd) SetFlags(f *flag.FlagSet) {
|
|
}
|
|
|
|
func (p *VersionCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
|
fmt.Println("Client: downloadhub cli")
|
|
fmt.Println(" Version: " + constants.Version)
|
|
fmt.Println(" Go version: " + runtime.Version())
|
|
fmt.Println(" OS/Arch: " + runtime.GOOS + "/" + runtime.GOARCH)
|
|
|
|
return subcommands.ExitSuccess
|
|
}
|