File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,8 +139,9 @@ func (c *ProjectsUpdateCmd) Run(out *output.Writer) error {
139139
140140// ProjectsDeleteCmd is `onecli projects delete`.
141141type ProjectsDeleteCmd struct {
142- ID string `required:"" help:"ID of the project to delete."`
143- DryRun bool `optional:"" name:"dry-run" help:"Validate the request without executing it."`
142+ ID string `required:"" help:"ID of the project to delete."`
143+ Confirm string `optional:"" help:"Project ID to confirm deletion. Required for destructive operation."`
144+ DryRun bool `optional:"" name:"dry-run" help:"Validate the request without executing it."`
144145}
145146
146147func (c * ProjectsDeleteCmd ) Run (out * output.Writer ) error {
@@ -150,10 +151,16 @@ func (c *ProjectsDeleteCmd) Run(out *output.Writer) error {
150151 if c .DryRun {
151152 return out .WriteDryRun ("Would delete project" , map [string ]string {"id" : c .ID })
152153 }
154+
155+ if c .Confirm != c .ID {
156+ return fmt .Errorf ("confirmation failed: pass --confirm %q to delete this project and all its data" , c .ID )
157+ }
158+
153159 client , err := newClient ()
154160 if err != nil {
155161 return err
156162 }
163+
157164 if err := client .DeleteProject (newContext (), c .ID ); err != nil {
158165 return err
159166 }
You can’t perform that action at this time.
0 commit comments