serverless arch
This commit is contained in:
42
cmd/cli/commands/sync/sync.go
Normal file
42
cmd/cli/commands/sync/sync.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"cloudsave/pkg/remote"
|
||||
"cloudsave/pkg/sync/ssh"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/google/subcommands"
|
||||
)
|
||||
|
||||
type (
|
||||
SyncCmd struct {
|
||||
}
|
||||
)
|
||||
|
||||
func (*SyncCmd) Name() string { return "sync" }
|
||||
func (*SyncCmd) Synopsis() string { return "list all game registered" }
|
||||
func (*SyncCmd) Usage() string {
|
||||
return `add:
|
||||
List all game registered
|
||||
`
|
||||
}
|
||||
|
||||
func (p *SyncCmd) SetFlags(f *flag.FlagSet) {
|
||||
}
|
||||
|
||||
func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
remotes, 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)
|
||||
}
|
||||
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
Reference in New Issue
Block a user