Skip to content

Commit

Permalink
add VM completion for run command
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Apr 9, 2024
1 parent 13e7794 commit d433871
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/tart/Commands/Run.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ var vm: VM?
struct IPNotFound: Error {
}

func completeVM(_ args: [String]) -> [String] {
if let vms = try? VMStorageLocal().list() {
return vms.map { (name, _) in return name }
}
return []
}


struct Run: AsyncParsableCommand {
static var configuration = CommandConfiguration(abstract: "Run a VM")

@Argument(help: "VM name")
@Argument(help: "VM name", completion: .custom(completeVM))
var name: String

@Flag(help: ArgumentHelp(
Expand Down

0 comments on commit d433871

Please sign in to comment.