Skip to content

Commit 2f8f3cd

Browse files
committed
Delete all VMs matching the given prefix
(not just running ones)
1 parent 4187888 commit 2f8f3cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/hostmgr/commands/vm/VMDelete.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct VMDeleteCommand: ParsableCommand {
2424
try vm?.delete()
2525

2626
if let prefix = startingWith {
27-
try VMLocalImageManager().lookupStoppedVMsBy(prefix: prefix).forEach { try $0.delete() }
27+
try VMLocalImageManager().lookupVMsBy(prefix: prefix).forEach { try $0.delete() }
2828
}
2929
}
3030
}

Sources/hostmgr/commands/vm/image/local/VMLocalImageManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ struct VMLocalImageManager {
3030
try Parallels().lookupVM(named: name)?.delete()
3131
}
3232

33-
func lookupStoppedVMsBy(handle: String) throws -> [StoppedVM] {
34-
return try Parallels().lookupStoppedVMs().filter { vm in
33+
func lookupVMsBy(handle: String) throws -> [VMProtocol] {
34+
return try Parallels().lookupAllVMs().filter { vm in
3535
return vm.name == handle || vm.uuid == handle
3636
}
3737
}
3838

39-
func lookupStoppedVMsBy(prefix: String) throws -> [StoppedVM] {
40-
return try Parallels().lookupStoppedVMs().filter { vm in
39+
func lookupVMsBy(prefix: String) throws -> [VMProtocol] {
40+
return try Parallels().lookupAllVMs().filter { vm in
4141
return vm.name.hasPrefix(prefix)
4242
}
4343
}

0 commit comments

Comments
 (0)