serverless arch

This commit is contained in:
2025-05-11 02:32:33 +02:00
parent 15b1efcc48
commit 30c71cb449
8 changed files with 291 additions and 27 deletions

View 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
}