better usage prompt + hash opti on server

This commit is contained in:
2025-08-06 23:09:12 +02:00
parent d479004217
commit 2f777c72ee
10 changed files with 176 additions and 26 deletions

View File

@@ -27,8 +27,9 @@ type (
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
return `Usage: cloudsave sync
Synchronize the archives with the server defined for each game.
`
}
@@ -47,6 +48,7 @@ func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
r, err := remote.One(g.ID)
if err != nil {
if errors.Is(err, remote.ErrNoRemote) {
fmt.Println(g.Name + ": no remote configured")
continue
}
fmt.Fprintln(os.Stderr, "error: failed to load datastore:", err)
@@ -85,6 +87,7 @@ func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
destroyPg()
slog.Warn("failed to push backup files", "err", err)
}
fmt.Println(g.Name + ": pushed")
continue
}
@@ -136,7 +139,7 @@ func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
continue
}
}
fmt.Println("already up-to-date")
fmt.Println(g.Name + ": already up-to-date")
continue
}
@@ -148,6 +151,7 @@ func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
return subcommands.ExitFailure
}
destroyPg()
fmt.Println(g.Name + ": pushed")
continue
}
@@ -168,6 +172,7 @@ func (p *SyncCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
fmt.Fprintln(os.Stderr, "error: failed to synchronize date:", err)
continue
}
fmt.Println(g.Name + ": pulled")
continue
}