2024-08-19 15:01:19 -04:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
import Foundation
|
|
|
|
import Virtualization
|
|
|
|
import ArgumentParser
|
|
|
|
|
|
|
|
@main
|
|
|
|
struct HostCli: ParsableCommand {
|
|
|
|
static var configuration = CommandConfiguration(
|
|
|
|
abstract: "A utility for running virtual machines",
|
|
|
|
subcommands: [Run.self],
|
|
|
|
defaultSubcommand: Run.self)
|
|
|
|
}
|
|
|
|
|
|
|
|
var config: Config = Config()
|
|
|
|
|
|
|
|
extension HostCli {
|
|
|
|
struct Run: ParsableCommand {
|
|
|
|
@Option var id: String
|
2024-10-29 13:49:51 -04:00
|
|
|
@Option var share: String?
|
2024-08-19 15:01:19 -04:00
|
|
|
|
|
|
|
mutating func run() {
|
|
|
|
config = Config(id)
|
2024-10-29 13:49:51 -04:00
|
|
|
config.sharedDir = share
|
|
|
|
print("Running vm with identifier \(id) and sharedDir \(share ?? "<none>")")
|
2024-08-19 15:01:19 -04:00
|
|
|
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|