File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Sources/ArgumentParser/Parsing Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,9 @@ struct AutodetectedGenerateCompletions: ParsableCommand {
345
345
@Flag ( ) var generateCompletionScript = false
346
346
}
347
347
348
+ func swiftBug72841Unwrap< T> ( _ x: T ) -> T { x }
349
+ func swiftBug72841Unwrap< T> ( _ x: T ? ) -> T { x! }
350
+
348
351
extension CommandParser {
349
352
func checkForCompletionScriptRequest( _ split: inout SplitArguments ) throws {
350
353
// Pseudo-commands don't support `--generate-completion-script` flag
@@ -363,14 +366,14 @@ extension CommandParser {
363
366
throw CommandError (
364
367
commandStack: commandStack,
365
368
parserError: . completionScriptRequested(
366
- shell: result. generateCompletionScript) )
369
+ shell: swiftBug72841Unwrap ( result) . generateCompletionScript) )
367
370
}
368
371
369
372
// Check for for `--generate-completion-script` without a value
370
373
var autodetectedParser = CommandParser ( AutodetectedGenerateCompletions . self)
371
374
if let result = try ? autodetectedParser. parseCurrent ( & split)
372
375
as? AutodetectedGenerateCompletions ,
373
- result. generateCompletionScript
376
+ swiftBug72841Unwrap ( result) . generateCompletionScript
374
377
{
375
378
throw CommandError (
376
379
commandStack: commandStack,
You can’t perform that action at this time.
0 commit comments