Skip to content

Commit 4ed4ac9

Browse files
authored
Merge branch 'apple:main' into custom-mac-address
2 parents 9c6a054 + 7197b41 commit 4ed4ac9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Sources/ContainerCommands/BuildCommand.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ extension Application {
3838
return config
3939
}
4040

41+
enum ProgressType: String, ExpressibleByArgument {
42+
case auto
43+
case plain
44+
case tty
45+
}
46+
4147
@Option(
4248
name: .shortAndLong,
4349
help: ArgumentHelp("Add the architecture type to the build", valueName: "value"),
@@ -99,8 +105,8 @@ extension Application {
99105
)
100106
var platform: [[String]] = [[]]
101107

102-
@Option(name: .long, help: ArgumentHelp("Progress type (format: auto|plain|tty)]", valueName: "type"))
103-
var progress: String = "auto"
108+
@Option(name: .long, help: ArgumentHelp("Progress type (format: auto|plain|tty)", valueName: "type"))
109+
var progress: ProgressType = .auto
104110

105111
@Flag(name: .shortAndLong, help: "Suppress build output")
106112
var quiet: Bool = false
@@ -221,14 +227,12 @@ extension Application {
221227

222228
var terminal: Terminal?
223229
switch self.progress {
224-
case "tty":
230+
case .tty:
225231
terminal = try Terminal(descriptor: STDERR_FILENO)
226-
case "auto":
232+
case .auto:
227233
terminal = try? Terminal(descriptor: STDERR_FILENO)
228-
case "plain":
234+
case .plain:
229235
terminal = nil
230-
default:
231-
throw ContainerizationError(.invalidArgument, message: "invalid progress mode \(self.progress)")
232236
}
233237

234238
defer { terminal?.tryReset() }

0 commit comments

Comments
 (0)