wip (apply)

This commit is contained in:
2025-10-20 01:35:32 +02:00
parent 8ca8918966
commit a95dd4f3e0
14 changed files with 354 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"flag"
"fmt"
"mirror-sync/pkg/client"
"mirror-sync/pkg/project"
"os"
@@ -18,7 +19,7 @@ type (
func (*ApplyCmd) Name() string { return "apply" }
func (*ApplyCmd) Synopsis() string { return "apply the current project settings" }
func (*ApplyCmd) Usage() string {
return `Usage: git-sync apply
return `Usage: mirror-sync apply
apply the current project settings
@@ -35,8 +36,12 @@ func (p *ApplyCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
fmt.Fprintf(os.Stderr, "error: %s\n", err)
return subcommands.ExitFailure
}
cli := client.New(projectConfig.ServerURL)
if err := cli.Apply(projectConfig); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
return subcommands.ExitFailure
}
return subcommands.ExitSuccess
}

View File

@@ -19,7 +19,7 @@ type (
func (*VersionCmd) Name() string { return "version" }
func (*VersionCmd) Synopsis() string { return "show version and system information" }
func (*VersionCmd) Usage() string {
return `Usage: cloudsave version
return `Usage: mirror-sync version
Print the version of the software
@@ -36,7 +36,7 @@ func (p *VersionCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{
}
func local() {
fmt.Println("Client: git-sync cli")
fmt.Println("Client: mirror-sync cli")
fmt.Println(" Version: " + constants.Version)
fmt.Println(" API version: " + strconv.Itoa(constants.ApiVersion))
fmt.Println(" Go version: " + runtime.Version())