server
This commit is contained in:
@@ -12,20 +12,18 @@ import (
|
||||
|
||||
type (
|
||||
ListCmd struct {
|
||||
name string
|
||||
}
|
||||
)
|
||||
|
||||
func (*ListCmd) Name() string { return "list" }
|
||||
func (*ListCmd) Synopsis() string { return "list all game registered" }
|
||||
func (*ListCmd) Usage() string {
|
||||
return `add:
|
||||
return `list:
|
||||
List all game registered
|
||||
`
|
||||
}
|
||||
|
||||
func (p *ListCmd) SetFlags(f *flag.FlagSet) {
|
||||
f.StringVar(&p.name, "name", "", "Override the name of the game")
|
||||
}
|
||||
|
||||
func (p *ListCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
|
||||
@@ -2,7 +2,6 @@ package sync
|
||||
|
||||
import (
|
||||
"cloudsave/pkg/remote"
|
||||
"cloudsave/pkg/sync/ssh"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -28,15 +27,15 @@ func (p *SyncCmd) SetFlags(f *flag.FlagSet) {
|
||||
}
|
||||
|
||||
func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
remotes, err := remote.All()
|
||||
_, err := remote.All()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error: failed to load datastore:", err)
|
||||
return subcommands.ExitFailure
|
||||
}
|
||||
|
||||
for _, remote := range remotes {
|
||||
ssh.SFTPSyncer{}.Sync(remote)
|
||||
}
|
||||
/*for _, remote := range remotes {
|
||||
|
||||
}*/
|
||||
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
|
||||
38
cmd/cli/commands/version/version.go
Normal file
38
cmd/cli/commands/version/version.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"cloudsave/pkg/constants"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"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 `add:
|
||||
Show version and system information
|
||||
`
|
||||
}
|
||||
|
||||
func (p *VersionCmd) SetFlags(f *flag.FlagSet) {
|
||||
}
|
||||
|
||||
func (p *VersionCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
fmt.Println("Client: CloudSave 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)
|
||||
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
Reference in New Issue
Block a user