@@ -2,7 +2,6 @@ package cdev
22
33import (
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
4553var 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