@@ -47,14 +47,14 @@ func Run(args []string) error {
4747 templateName = args [i + 1 ]
4848 i ++
4949 } else {
50- return shared .FormatError ("create" , " flag -t/--template requires a value" )
50+ return shared .FormatError ("flag -t/--template requires a value" )
5151 }
5252 case "-d" , "--destination" :
5353 if i + 1 < len (args ) {
5454 destination = args [i + 1 ]
5555 i ++
5656 } else {
57- return shared .FormatError ("create" , " flag -d/--destination requires a value" )
57+ return shared .FormatError ("flag -d/--destination requires a value" )
5858 }
5959 case "--git" :
6060 gitInit = true
@@ -77,18 +77,18 @@ func Run(args []string) error {
7777
7878 // Validate mutually exclusive flags
7979 if gitInit && noGit {
80- return shared .FormatError ("create" , " cannot use both --git and --no-git flags" )
80+ return shared .FormatError ("cannot use both --git and --no-git flags" )
8181 }
8282 if executeHooks && noHooks {
83- return shared .FormatError ("create" , " cannot use both --hooks and --no-hooks flags" )
83+ return shared .FormatError ("cannot use both --hooks and --no-hooks flags" )
8484 }
8585
8686 // Interactive mode if flags not provided
8787 if templateName == "" {
8888 // List available templates
8989 templates , err := storage .ListTemplates ()
9090 if err != nil {
91- return shared .FormatError ("create" , fmt .Sprintf ("failed to list templates: %v" , err ))
91+ return shared .FormatError (fmt .Sprintf ("failed to list templates: %v" , err ))
9292 }
9393
9494 if len (templates ) == 0 {
@@ -104,7 +104,7 @@ func Run(args []string) error {
104104 fmt .Printf ("%sCancelled.%s\n " , shared .ColorYellow , shared .ColorReset )
105105 return nil
106106 }
107- return shared .FormatError ("create" , fmt .Sprintf ("selection failed: %v" , err ))
107+ return shared .FormatError (fmt .Sprintf ("selection failed: %v" , err ))
108108 }
109109 templateName = selectedTemplate
110110
@@ -119,24 +119,24 @@ func Run(args []string) error {
119119 fmt .Printf ("%sCancelled.%s\n " , shared .ColorYellow , shared .ColorReset )
120120 return nil
121121 }
122- return shared .FormatError ("create" , " failed to read input" )
122+ return shared .FormatError ("failed to read input" )
123123 }
124124 destination = dest
125125 fmt .Printf ("%s✓ Destination set:%s %s\n " , shared .ColorGreen , shared .ColorReset , destination )
126126 }
127127
128128 // Validate template name
129129 if err := shared .SanitizeTemplateName (templateName ); err != nil {
130- return shared .FormatError ("create" , err .Error ())
130+ return shared .FormatError (err .Error ())
131131 }
132132
133133 // Check if template exists
134134 exists , err := storage .TemplateExists (templateName )
135135 if err != nil {
136- return shared .FormatError ("create" , fmt .Sprintf ("failed to check template: %v" , err ))
136+ return shared .FormatError (fmt .Sprintf ("failed to check template: %v" , err ))
137137 }
138138 if ! exists {
139- return shared .FormatError ("create" , fmt .Sprintf ("template '%s' not found" , templateName ))
139+ return shared .FormatError (fmt .Sprintf ("template '%s' not found" , templateName ))
140140 }
141141
142142 // Handle destination path resolution
@@ -146,35 +146,35 @@ func Run(args []string) error {
146146 if destination == "." {
147147 destAbs , err = os .Getwd ()
148148 if err != nil {
149- return shared .FormatError ("create" , fmt .Sprintf ("failed to get current directory: %v" , err ))
149+ return shared .FormatError (fmt .Sprintf ("failed to get current directory: %v" , err ))
150150 }
151151 } else {
152152 // Get absolute path
153153 destAbs , err = filepath .Abs (destination )
154154 if err != nil {
155- return shared .FormatError ("create" , fmt .Sprintf ("invalid destination path: %v" , err ))
155+ return shared .FormatError (fmt .Sprintf ("invalid destination path: %v" , err ))
156156 }
157157 }
158158
159159 // Check if parent directory exists for nested paths
160160 parentDir := filepath .Dir (destAbs )
161161 if parentDir != "." && parentDir != "/" {
162162 if _ , err := os .Stat (parentDir ); os .IsNotExist (err ) {
163- return shared .FormatError ("create" , fmt .Sprintf ("parent directory does not exist: %s" , parentDir ))
163+ return shared .FormatError (fmt .Sprintf ("parent directory does not exist: %s" , parentDir ))
164164 }
165165 }
166166
167167 // Check if destination already exists
168168 if stat , err := os .Stat (destAbs ); err == nil {
169169 // Destination exists - check if it's a directory
170170 if ! stat .IsDir () {
171- return shared .FormatError ("create" , fmt .Sprintf ("destination exists and is not a directory: %s" , destAbs ))
171+ return shared .FormatError (fmt .Sprintf ("destination exists and is not a directory: %s" , destAbs ))
172172 }
173173
174174 // Check if directory is empty
175175 entries , err := os .ReadDir (destAbs )
176176 if err != nil {
177- return shared .FormatError ("create" , fmt .Sprintf ("failed to read destination directory: %v" , err ))
177+ return shared .FormatError (fmt .Sprintf ("failed to read destination directory: %v" , err ))
178178 }
179179
180180 if len (entries ) > 0 {
@@ -184,7 +184,7 @@ func Run(args []string) error {
184184
185185 confirmed , err := shared .PromptConfirmWithDefault ("Do you want to remove and recreate the directory?" , false )
186186 if err != nil {
187- return shared .FormatError ("create" , " failed to read confirmation" )
187+ return shared .FormatError ("failed to read confirmation" )
188188 }
189189
190190 if ! confirmed {
@@ -194,7 +194,7 @@ func Run(args []string) error {
194194
195195 // Remove existing directory
196196 if err := os .RemoveAll (destAbs ); err != nil {
197- return shared .FormatError ("create" , fmt .Sprintf ("failed to remove existing directory: %v" , err ))
197+ return shared .FormatError (fmt .Sprintf ("failed to remove existing directory: %v" , err ))
198198 }
199199 fmt .Printf ("%s✓ Removed existing directory%s\n " , shared .ColorGreen , shared .ColorReset )
200200 }
@@ -203,13 +203,13 @@ func Run(args []string) error {
203203 // Get template path
204204 templatePath , err := storage .GetTemplatePath (templateName )
205205 if err != nil {
206- return shared .FormatError ("create" , fmt .Sprintf ("failed to get template path: %v" , err ))
206+ return shared .FormatError (fmt .Sprintf ("failed to get template path: %v" , err ))
207207 }
208208
209209 // Load template configuration if exists
210210 cfg , err := config .LoadConfig (templatePath )
211211 if err != nil {
212- return shared .FormatError ("create" , fmt .Sprintf ("failed to load template config: %v" , err ))
212+ return shared .FormatError (fmt .Sprintf ("failed to load template config: %v" , err ))
213213 }
214214
215215 // Display template metadata if available
@@ -236,7 +236,7 @@ func Run(args []string) error {
236236 if spinner != nil {
237237 spinner .Fail (fmt .Sprintf ("Failed to create project: %v" , err ))
238238 }
239- return shared .FormatError ("create" , fmt .Sprintf ("failed to create project: %v" , err ))
239+ return shared .FormatError (fmt .Sprintf ("failed to create project: %v" , err ))
240240 }
241241
242242 if spinner != nil {
@@ -266,7 +266,7 @@ func Run(args []string) error {
266266 var err error
267267 confirmed , err = shared .PromptConfirmWithDefault ("Execute hooks?" , true )
268268 if err != nil {
269- return shared .FormatError ("create" , " failed to read confirmation" )
269+ return shared .FormatError ("failed to read confirmation" )
270270 }
271271 }
272272
@@ -289,7 +289,7 @@ func Run(args []string) error {
289289 var err error
290290 gitInit , err = shared .PromptConfirmWithDefault ("Initialize git repository?" , false )
291291 if err != nil {
292- return shared .FormatError ("create" , " failed to read confirmation" )
292+ return shared .FormatError ("failed to read confirmation" )
293293 }
294294 }
295295
0 commit comments