@@ -22,7 +22,7 @@ func entryPoint(passing args: consuming __CommandLineArguments_v0?, eventHandler
22
22
23
23
do {
24
24
let args = try args ?? parseCommandLineArguments ( from: CommandLine . arguments ( ) )
25
- if args. listTests {
25
+ if args. listTests ?? true {
26
26
for testID in await listTestsForEntryPoint ( Test . all) {
27
27
#if SWT_TARGET_OS_APPLE && !SWT_NO_FILE_IO
28
28
try ? FileHandle . stdout. write ( " \( testID) \n " )
@@ -55,7 +55,7 @@ func entryPoint(passing args: consuming __CommandLineArguments_v0?, eventHandler
55
55
#if !SWT_NO_FILE_IO
56
56
var options = Event . ConsoleOutputRecorder. Options ( )
57
57
options = . for( . stderr)
58
- options. isVerbose = args. verbose
58
+ options. verbosity = args. verbosity
59
59
let eventRecorder = Event . ConsoleOutputRecorder ( options: options) { string in
60
60
try ? FileHandle . stderr. write ( string)
61
61
}
@@ -143,13 +143,49 @@ public struct __CommandLineArguments_v0: Sendable {
143
143
public init ( ) { }
144
144
145
145
/// The value of the `--list-tests` argument.
146
- public var listTests = false
146
+ public var listTests : Bool ? = false
147
147
148
148
/// The value of the `--parallel` or `--no-parallel` argument.
149
- public var parallel = true
149
+ public var parallel : Bool ? = true
150
150
151
151
/// The value of the `--verbose` argument.
152
- public var verbose = false
152
+ public var verbose : Bool ? = false
153
+
154
+ /// The value of the `--very-verbose` argument.
155
+ public var veryVerbose : Bool ? = false
156
+
157
+ /// The value of the `--quiet` argument.
158
+ public var quiet : Bool ? = false
159
+
160
+ /// Storage for the ``verbosity`` property.
161
+ private var _verbosity : Int ?
162
+
163
+ /// The value of the `--verbosity` argument.
164
+ ///
165
+ /// The value of this property may be synthesized from the `--verbose`,
166
+ /// `--very-verbose`, or `--quiet` arguments.
167
+ ///
168
+ /// When the value of this property is greater than `0`, additional output
169
+ /// is provided. When the value of this property is less than `0`, some
170
+ /// output is suppressed. The exact effects of this property are
171
+ /// implementation-defined and subject to change.
172
+ public var verbosity : Int {
173
+ get {
174
+ if let _verbosity {
175
+ return _verbosity
176
+ } else if veryVerbose == true {
177
+ return 2
178
+ } else if verbose == true {
179
+ return 1
180
+ } else if quiet == true {
181
+ return - 1
182
+ }
183
+ return 0
184
+ }
185
+ set {
186
+ _verbosity = newValue
187
+ }
188
+ }
153
189
154
190
/// The value of the `--xunit-output` argument.
155
191
public var xunitOutput : String ?
@@ -201,7 +237,26 @@ public struct __CommandLineArguments_v0: Sendable {
201
237
var xcTestCaseHostIdentifier : String ?
202
238
}
203
239
204
- extension __CommandLineArguments_v0 : Codable { }
240
+ extension __CommandLineArguments_v0 : Codable {
241
+ // Explicitly list the coding keys so that storage properties like _verbosity
242
+ // do not end up with leading underscores when encoded.
243
+ enum CodingKeys : String , CodingKey {
244
+ case listTests
245
+ case parallel
246
+ case verbose
247
+ case veryVerbose
248
+ case quiet
249
+ case _verbosity = " verbosity "
250
+ case xunitOutput
251
+ case experimentalEventStreamOutput
252
+ case experimentalEventStreamVersion
253
+ case filter
254
+ case skip
255
+ case repetitions
256
+ case repeatUntil
257
+ case xcTestCaseHostIdentifier
258
+ }
259
+ }
205
260
206
261
/// Initialize this instance given a sequence of command-line arguments passed
207
262
/// from Swift Package Manager.
@@ -268,9 +323,20 @@ func parseCommandLineArguments(from args: [String]) throws -> __CommandLineArgum
268
323
result. parallel = false
269
324
}
270
325
271
- if args. contains ( " --verbose " ) || args. contains ( " -v " ) || args. contains ( " --very-verbose " ) || args. contains ( " --vv " ) {
326
+ // Verbosity
327
+ if let verbosityIndex = args. firstIndex ( of: " --verbosity " ) , !isLastArgument( at: verbosityIndex) ,
328
+ let verbosity = Int ( args [ args. index ( after: verbosityIndex) ] ) {
329
+ result. verbosity = verbosity
330
+ }
331
+ if args. contains ( " --verbose " ) || args. contains ( " -v " ) {
272
332
result. verbose = true
273
333
}
334
+ if args. contains ( " --very-verbose " ) || args. contains ( " --vv " ) {
335
+ result. veryVerbose = true
336
+ }
337
+ if args. contains ( " --quiet " ) || args. contains ( " -q " ) {
338
+ result. quiet = true
339
+ }
274
340
275
341
// Filtering
276
342
func filterValues( forArgumentsWithLabel label: String ) -> [ String ] {
@@ -308,7 +374,7 @@ public func configurationForEntryPoint(from args: __CommandLineArguments_v0) thr
308
374
var configuration = Configuration ( )
309
375
310
376
// Parallelization (on by default)
311
- configuration. isParallelizationEnabled = args. parallel
377
+ configuration. isParallelizationEnabled = args. parallel ?? true
312
378
313
379
#if !SWT_NO_FILE_IO
314
380
// XML output
0 commit comments