@@ -21,35 +21,38 @@ var createListCmd = &cobra.Command{
2121
2222func init () {
2323 rootCmd .AddCommand (createCmd )
24+ createCmd .AddCommand (createListCmd )
2425
25- flag := createCmd .Flags ()
26- name := flag .String ("name" , "" , "Name of the new Sphere project" )
27- module := flag .String ("module" , "" , "Go module name for the project (optional)" )
28- layout := flag .String ("layout" , "" , "Custom template layout URI (optional)" )
29-
30- createCmd .RunE = func (cmd * cobra.Command , args []string ) error {
31- if * name == "" {
32- return errors .New ("--name is required" )
33- }
34- if * module == "" {
35- module = name // Default to the project name if no module is specified
26+ {
27+ flag := createCmd .Flags ()
28+ name := flag .String ("name" , "" , "Name of the new Sphere project" )
29+ module := flag .String ("module" , "" , "Go module name for the project (optional)" )
30+ layout := flag .String ("layout" , "" , "Custom template layout URI (optional)" )
31+ createCmd .RunE = func (cmd * cobra.Command , args []string ) error {
32+ if * name == "" {
33+ return errors .New ("--name is required" )
34+ }
35+ if * module == "" {
36+ module = name // Default to the project name if no module is specified
37+ }
38+ tmpl , err := create .Layout (* layout )
39+ if err != nil {
40+ return err
41+ }
42+ return create .Project (* name , * module , tmpl )
3643 }
37- tmpl , err := create .Layout (* layout )
38- if err != nil {
39- return err
40- }
41- return create .Project (* name , * module , tmpl )
4244 }
4345
44- createCmd .AddCommand (createListCmd )
45- createListCmd .RunE = func (cmd * cobra.Command , args []string ) error {
46- templates , err := create .LayoutList ()
47- if err != nil {
48- return err
49- }
50- for _ , item := range templates {
51- cmd .Println (item .Name , ":" , item .Description , " (" , item .Path , ")" )
46+ {
47+ createListCmd .RunE = func (cmd * cobra.Command , args []string ) error {
48+ templates , err := create .LayoutList ()
49+ if err != nil {
50+ return err
51+ }
52+ for _ , item := range templates {
53+ cmd .Println (item .Name , ":" , item .Description , " (" , item .Path , ")" )
54+ }
55+ return nil
5256 }
53- return nil
5457 }
5558}
0 commit comments