wip
This commit is contained in:
@@ -4,7 +4,10 @@ import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"mirror-sync/cmd/cli/config"
|
||||
"mirror-sync/pkg/client"
|
||||
"mirror-sync/pkg/constants"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
@@ -31,14 +34,31 @@ func (p *VersionCmd) SetFlags(f *flag.FlagSet) {
|
||||
}
|
||||
|
||||
func (p *VersionCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
local()
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
|
||||
func local() {
|
||||
fmt.Println("Client: mirror-sync cli")
|
||||
fmt.Println(" Version: " + constants.Version)
|
||||
fmt.Println(" API version: " + strconv.Itoa(constants.ApiVersion))
|
||||
fmt.Println(" Go version: " + runtime.Version())
|
||||
fmt.Println(" OS/Arch: " + runtime.GOOS + "/" + runtime.GOARCH)
|
||||
|
||||
clientConfig := config.Load()
|
||||
|
||||
cli := client.New(clientConfig.Deamon.URL)
|
||||
systemInfoDaemon, err := cli.Version()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %s\n", err)
|
||||
return subcommands.ExitFailure
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println("Daemon:")
|
||||
fmt.Println(" Version: " + systemInfoDaemon.Version)
|
||||
fmt.Println(" API version: " + strconv.Itoa(systemInfoDaemon.APIVersion))
|
||||
fmt.Println(" Go version: " + systemInfoDaemon.GoVersion)
|
||||
fmt.Println(" OS/Arch: " + systemInfoDaemon.OSName + "/" + systemInfoDaemon.OSArchitecture)
|
||||
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
|
||||
func local() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user