@@ -39,24 +39,8 @@ No local files are deleted.
3939 RunE : func (cmd * cobra.Command , args []string ) error {
4040 // Layer 2: Catch technical errors and provide CLI-specific user-friendly messages
4141 err := runDelete (cmd , args , newClient )
42- if err != nil && errors .Is (err , fn .ErrNameRequiredForDelete ) {
43- return fmt .Errorf (`%v
44-
45- You can delete functions in two ways:
46-
47- 1. By name :
48- func delete myfunction Delete function by name
49- func delete myfunction --namespace apps Delete from specific namespace
50-
51- 2. By path :
52- func delete --path /path/to/function Delete function at specific path
53-
54- Examples:
55- func delete myfunction Delete 'myfunction' from cluster
56- func delete myfunction --namespace prod Delete from 'prod' namespace
57- func delete --path ./myfunction Delete function at path
58-
59- For more options, run 'func delete --help'` , err )
42+ if err != nil && errors .Is (err , fn .ErrNameRequired ) {
43+ return formatDeleteNameRequiredError (err )
6044 }
6145 return err
6246 },
@@ -92,7 +76,7 @@ func runDelete(cmd *cobra.Command, args []string, newClient ClientFactory) (err
9276 }
9377 if ! f .Initialized () {
9478 // Return technical error (Layer 1) - will be caught and enhanced by CLI
95- return fn .ErrNameRequiredForDelete
79+ return fn .ErrNameRequired
9680 }
9781 }
9882
@@ -191,3 +175,27 @@ func (c deleteConfig) Prompt() (deleteConfig, error) {
191175
192176 return dc , err
193177}
178+
179+ // formatDeleteNameRequiredError provides CLI-specific user-friendly error message
180+ // for delete command when function name is required
181+ func formatDeleteNameRequiredError (err error ) error {
182+ return fmt .Errorf (`%v
183+
184+ Function name is required for deletion (or --path not specified).
185+
186+ You can delete functions in two ways:
187+
188+ 1. By name :
189+ func delete myfunction Delete function by name
190+ func delete myfunction --namespace apps Delete from specific namespace
191+
192+ 2. By path :
193+ func delete --path /path/to/function Delete function at specific path
194+
195+ Examples:
196+ func delete myfunction Delete 'myfunction' from cluster
197+ func delete myfunction --namespace prod Delete from 'prod' namespace
198+ func delete --path ./myfunction Delete function at path
199+
200+ For more options, run 'func delete --help'` , err )
201+ }
0 commit comments