wip
This commit is contained in:
@@ -4,15 +4,18 @@ import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"mirror-sync/cmd/cli/config"
|
||||
"mirror-sync/pkg/client"
|
||||
"mirror-sync/pkg/project"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/google/subcommands"
|
||||
)
|
||||
|
||||
type (
|
||||
ApplyCmd struct {
|
||||
projectName string
|
||||
}
|
||||
)
|
||||
|
||||
@@ -28,10 +31,22 @@ Options:
|
||||
}
|
||||
|
||||
func (p *ApplyCmd) SetFlags(f *flag.FlagSet) {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
f.StringVar(&p.projectName, "project-name", filepath.Base(wd), "set the project name")
|
||||
}
|
||||
|
||||
func (p *ApplyCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
projectConfig, err := project.LoadCurrent()
|
||||
clientConfig := config.Load()
|
||||
|
||||
defaultValues := project.DefaultValues{
|
||||
DaemonURL: clientConfig.Deamon.URL,
|
||||
ProjectName: p.projectName,
|
||||
}
|
||||
|
||||
projectConfig, err := project.LoadCurrent(defaultValues)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %s\n", err)
|
||||
return subcommands.ExitFailure
|
||||
|
||||
Reference in New Issue
Block a user