Skip to content

Commit 8a23e0b

Browse files
authored
Update 06 Manual Parsing and Testing.md (#40)
`ParsableCommand.parseAsRoot()` drops the first item from `CommandLine.arguments` when it receives a `nil` array as a parameter, so it is necessary to do the same before pre-processing arguments to feed to any `ParsableCommand`.
1 parent fd5b49c commit 8a23e0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Documentation/06 Manual Parsing and Testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ All of the parsing methods — `parse()`, `parseOrExit()`, and `parseAsRoot()`
8888
Let's update our `select` script above to strip out any words that contain all capital letters before parsing the inputs.
8989

9090
```swift
91-
let noShoutingArguments = CommandLine.arguments.filter { phrase in
91+
let noShoutingArguments = CommandLine.arguments.dropFirst().filter { phrase in
9292
phrase.uppercased() != phrase
9393
}
9494
let options = SelectOptions.parseOrExit(noShoutingArguments)

0 commit comments

Comments
 (0)