This commit is contained in:
2025-08-09 22:19:57 +02:00
parent 13adb26fba
commit 810c5ac627
13 changed files with 605 additions and 790 deletions

View File

@@ -1,9 +1,9 @@
package remote
import (
"cloudsave/pkg/data"
"cloudsave/pkg/remote"
"cloudsave/pkg/remote/client"
"cloudsave/pkg/repository"
"context"
"flag"
"fmt"
@@ -14,8 +14,9 @@ import (
type (
RemoteCmd struct {
set bool
list bool
Service *data.Service
set bool
list bool
}
)
@@ -43,7 +44,7 @@ func (p *RemoteCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface
switch {
case p.list:
{
if err := list(); err != nil {
if err := p.print(); err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
return subcommands.ExitFailure
}
@@ -68,8 +69,8 @@ func (p *RemoteCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface
return subcommands.ExitSuccess
}
func list() error {
games, err := repository.All()
func (p *RemoteCmd) print() error {
games, err := p.Service.AllGames()
if err != nil {
return fmt.Errorf("failed to load datastore: %w", err)
}