()
| 309 | } |
| 310 | |
| 311 | func newGuestsDeleteCmd() *cobra.Command { |
| 312 | cmd := &cobra.Command{ |
| 313 | Use: "delete <vmid>", |
| 314 | Short: "Permanently delete a guest", |
| 315 | Long: `Permanently delete a VM or container and all its associated disks. |
| 316 | |
| 317 | WARNING: This operation is irreversible. The guest must be stopped before deletion |
| 318 | unless --force is passed.`, |
| 319 | Example: ` pvetui guests delete 108 |
| 320 | pvetui guests delete 108 --purge |
| 321 | pvetui guests delete 108 --force --no-wait`, |
| 322 | Args: cobra.ExactArgs(1), |
| 323 | ValidArgsFunction: completeVMIDs, |
| 324 | RunE: runGuestsDelete, |
| 325 | } |
| 326 | |
| 327 | cmd.Flags().Bool("purge", false, "Remove VMID from backup and replication jobs") |
| 328 | cmd.Flags().Bool("force", false, "Force deletion even if the guest is running") |
| 329 | addNoWaitFlag(cmd) |
| 330 | |
| 331 | return cmd |
| 332 | } |
| 333 | |
| 334 | func runGuestsDelete(cmd *cobra.Command, args []string) error { |
| 335 | vmid, err := parseVMID(args[0]) |
no test coverage detected