Skip to content

Commit 475e56c

Browse files
authored
Merge pull request #132 from shalb/new-generator
New generator
2 parents 4ff27a9 + faac998 commit 475e56c

File tree

39 files changed

+322
-454
lines changed

39 files changed

+322
-454
lines changed

examples/aws-eks/backend.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/aws-eks/infra.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/aws-eks/project.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/aws-k3s/backend.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/aws-k3s/infra.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/aws-k3s/project.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/do-k8s/backend.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/do-k8s/infra.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/do-k8s/project.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

pkg/cmd/cdev/project.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cdev
22

33
import (
44
"fmt"
5-
"strings"
65

76
"github.com/apex/log"
87
"github.com/shalb/cluster.dev/pkg/config"
@@ -22,8 +21,8 @@ func init() {
2221
rootCmd.AddCommand(projectCmd)
2322
projectCmd.AddCommand(projectLs)
2423
projectCmd.AddCommand(projectCreate)
25-
projectCreate.Flags().BoolVar(&config.Global.Interactive, "interactive", false, "Use intteractive mode to for project generation")
26-
projectCreate.Flags().BoolVar(&listAllTemplates, "list-templates", false, "Show all available templates for project generator.")
24+
projectCreate.Flags().BoolVar(&config.Global.Interactive, "interactive", false, "Use interactive mode for project generation")
25+
projectCreate.Flags().BoolVar(&listAllTemplates, "list-templates", false, "Show all available templates for project generation")
2726
}
2827

2928
// projectsCmd represents the plan command
@@ -39,27 +38,29 @@ var projectLs = &cobra.Command{
3938
log.Info("Project info:")
4039
p.PrintInfo()
4140
},
41+
Args: func(cmd *cobra.Command, args []string) error {
42+
if len(args) < 1 {
43+
return fmt.Errorf("requires a template git URL argument")
44+
}
45+
if len(args) > 2 {
46+
return fmt.Errorf("too many arguments")
47+
}
48+
return nil
49+
},
4250
}
4351

4452
// projectsCmd represents the plan command
4553
var projectCreate = &cobra.Command{
4654
Use: "create",
4755
Short: "Generate new project from template in curent dir. Directory must be empty",
4856
Run: func(cmd *cobra.Command, args []string) {
49-
50-
if listAllTemplates {
51-
list, err := ui.GetProjectTemplates()
52-
if err != nil {
53-
log.Fatalf("List project templates: %v", err.Error())
54-
}
55-
res := strings.Join(list, "\n")
56-
fmt.Println(res)
57-
return
58-
}
5957
if project.ProjectsFilesExists() {
6058
log.Fatalf("project creating: some project's data (yaml files) found in current directory, use command in empty dir")
6159
}
62-
err := ui.CreteProject(config.Global.WorkingDir, args...)
60+
if len(args) < 1 {
61+
log.Fatal("project creating: ")
62+
}
63+
err := ui.CreteProject(config.Global.WorkingDir, args[0], args[1:]...)
6364
if err != nil {
6465
log.Fatalf("Create project: %v", err.Error())
6566
}

0 commit comments

Comments
 (0)