Skip to content

Commit

Permalink
Merge branch 'main' into mi/use-synthesized-by-default
Browse files Browse the repository at this point in the history
  • Loading branch information
marciniwanicki authored Nov 2, 2024
2 parents a08f52e + 5b632e6 commit d4a7f55
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Sources/CurieCommand/Commands/RunCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct RunCommand: Command {
@Argument(help: "Reference \(CurieCore.Constants.referenceFormat).")
var reference: String

@Flag(name: .shortAndLong, help: "Do not create window.")
var noWindow: Bool = false
@Flag(name: .customLong("window"), inversion: .prefixedNo, help: "Create window or not.")
var showWindow: Bool = true

@Flag(name: .shortAndLong, help: "Start in recovery mode.")
var recoveryMode: Bool = false
Expand Down Expand Up @@ -61,7 +61,7 @@ struct RunCommand: Command {
with: .init(
reference: command.reference,
launch: .init(
noWindow: command.noWindow,
showWindow: command.showWindow,
mainScreenResolution: command.mainScreenResolution,
recoveryMode: command.recoveryMode,
shareCurrentWorkingDirectory: command.shareCWD,
Expand Down
6 changes: 3 additions & 3 deletions Sources/CurieCommand/Commands/StartCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct StartCommand: Command {
@Argument(help: "Reference \(CurieCore.Constants.referenceFormat).")
var reference: String

@Flag(name: .shortAndLong, help: "Do not create window.")
var noWindow: Bool = false
@Flag(name: .customLong("window"), inversion: .prefixedNo, help: "Create window or not.")
var showWindow: Bool = true

@Flag(name: .shortAndLong, help: "Pause on exit (requires macOS 14.0+).")
var pauseOnExit: Bool = false
Expand Down Expand Up @@ -64,7 +64,7 @@ struct StartCommand: Command {
with: .init(
reference: command.reference,
launch: .init(
noWindow: command.noWindow,
showWindow: command.showWindow,
mainScreenResolution: command.mainScreenResolution,
recoveryMode: command.recoveryMode,
shareCurrentWorkingDirectory: command.shareCWD,
Expand Down
6 changes: 3 additions & 3 deletions Sources/CurieCore/Interactors/Common/LaunchParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ import CurieCommon
import Foundation

public struct LaunchParameters {
public var noWindow: Bool
public var showWindow: Bool
public var mainScreenResolution: Bool
public var recoveryMode: Bool
public var shareCurrentWorkingDirectory: Bool
public var pauseOnExit: Bool

public init(
noWindow: Bool,
showWindow: Bool,
mainScreenResolution: Bool,
recoveryMode: Bool,
shareCurrentWorkingDirectory: Bool,
pauseOnExit: Bool
) {
self.noWindow = noWindow
self.showWindow = showWindow
self.mainScreenResolution = mainScreenResolution
self.recoveryMode = recoveryMode
self.shareCurrentWorkingDirectory = shareCurrentWorkingDirectory
Expand Down
2 changes: 1 addition & 1 deletion Sources/CurieCore/Interactors/RunInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class DefaultRunInteractor: RunInteractor {
let vm = try configurator.loadVM(with: bundle, overrideConfig: overrideConfig)
let options = VMStartOptions(
startUpFromMacOSRecovery: context.launch.recoveryMode,
noWindow: context.launch.noWindow
showWindow: context.launch.showWindow
)

vm.events
Expand Down
2 changes: 1 addition & 1 deletion Sources/CurieCore/Interactors/StartInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final class DefaultStartInteractor: StartInteractor {
let vm = try configurator.loadVM(with: bundle, overrideConfig: overrideConfig)
let options = VMStartOptions(
startUpFromMacOSRecovery: context.launch.recoveryMode,
noWindow: context.launch.noWindow
showWindow: context.launch.showWindow
)

try imageRunner.run(vm: vm, bundle: bundle, options: options)
Expand Down
8 changes: 4 additions & 4 deletions Sources/CurieCore/VM/ImageRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ final class DefaultImageRunner: ImageRunner {
}

// Launch interface
if options.noWindow {
console.text("Launch container without a window")
launchConsole(with: vm, bundle: bundle)
} else {
if options.showWindow {
console.text("Launch container in a window")
launchWindow(with: vm, bundle: bundle)
} else {
console.text("Launch container without a window")
launchConsole(with: vm, bundle: bundle)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/CurieCore/VM/VM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Virtualization

struct VMStartOptions {
var startUpFromMacOSRecovery: Bool
var noWindow: Bool
var showWindow: Bool
}

final class VM: NSObject {
Expand Down

0 comments on commit d4a7f55

Please sign in to comment.