|
@@ -24,7 +24,7 @@ struct UTMCtl: ParsableCommand {
|
|
|
static var configuration = CommandConfiguration(
|
|
|
commandName: "utmctl",
|
|
|
abstract: "CLI tool for controlling UTM virtual machines.",
|
|
|
- subcommands: [List.self, Status.self, Start.self, Suspend.self, Stop.self, Attach.self, File.self, Exec.self, IPAddress.self, Clone.self]
|
|
|
+ subcommands: [List.self, Status.self, Start.self, Suspend.self, Stop.self, Attach.self, File.self, Exec.self, IPAddress.self, Clone.self, Delete.self]
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -484,6 +484,23 @@ extension UTMCtl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+extension UTMCtl {
|
|
|
+ struct Delete: UTMAPICommand {
|
|
|
+ static var configuration = CommandConfiguration(
|
|
|
+ abstract: "Delete a virtual machine (there is no confirmation)."
|
|
|
+ )
|
|
|
+
|
|
|
+ @OptionGroup var environment: EnvironmentOptions
|
|
|
+
|
|
|
+ @OptionGroup var identifer: VMIdentifier
|
|
|
+
|
|
|
+ func run(with application: UTMScriptingApplication) throws {
|
|
|
+ let vm = try virtualMachine(forIdentifier: identifer, in: application)
|
|
|
+ vm.delete!()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
extension UTMCtl {
|
|
|
struct VMIdentifier: ParsableArguments {
|
|
|
@Argument(help: "Either the UUID or the complete name of the virtual machine.")
|