(opts *DeleteOptions)
| 62 | } |
| 63 | |
| 64 | func deleteRun(opts *DeleteOptions) error { |
| 65 | if !opts.NoPrompt { |
| 66 | if err := PromptMissing(opts); err != nil { |
| 67 | return err |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | if opts.IdOrName == "" { |
| 72 | return fmt.Errorf("project identifier is required but was not provided") |
| 73 | } |
| 74 | |
| 75 | itemToDelete, err := opts.Client.Projects.GetByIdentifier(opts.IdOrName) |
| 76 | if err != nil { |
| 77 | return err |
| 78 | } |
| 79 | |
| 80 | if opts.ConfirmFlags.Confirm.Value { |
| 81 | return delete(opts.Client, itemToDelete) |
| 82 | } else { |
| 83 | return question.DeleteWithConfirmation(opts.Ask, "project", itemToDelete.Name, itemToDelete.ID, func() error { |
| 84 | return delete(opts.Client, itemToDelete) |
| 85 | }) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func PromptMissing(opts *DeleteOptions) error { |
| 90 | if opts.IdOrName == "" { |
no test coverage detected