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

@@ -1,32 +1,39 @@
package add
import (
"cloudsave/pkg/remote"
"cloudsave/pkg/repository"
"context"
"flag"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/google/subcommands"
)
type (
AddCmd struct {
name string
name string
remote string
}
)
func (*AddCmd) Name() string { return "add" }
func (*AddCmd) Synopsis() string { return "Add a folder to the sync list" }
func (*AddCmd) Synopsis() string { return "add a folder to the sync list" }
func (*AddCmd) Usage() string {
return `add:
Add a folder to the sync list
return `Usage: cloudsave add [-name] [-remote] <PATH>
Add a folder to the track list
Options:
`
}
func (p *AddCmd) SetFlags(f *flag.FlagSet) {
f.StringVar(&p.name, "name", "", "Override the name of the game")
f.StringVar(&p.remote, "remote", "", "Defines a remote server to sync with")
}
func (p *AddCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
@@ -50,6 +57,10 @@ func (p *AddCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) s
return subcommands.ExitFailure
}
if len(strings.TrimSpace(p.remote)) > 0 {
remote.Set(m.ID, p.remote)
}
fmt.Println(m.ID)
return subcommands.ExitSuccess