From 7803cf71ceb6af1c268c6b9175c2a1d6e475e086 Mon Sep 17 00:00:00 2001 From: Guillaume Lessard Date: Mon, 2 Mar 2020 09:36:10 -0700 Subject: [PATCH] Update 06 Manual Parsing and Testing.md `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`. --- Documentation/06 Manual Parsing and Testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/06 Manual Parsing and Testing.md b/Documentation/06 Manual Parsing and Testing.md index 4aba8f949..c31294026 100644 --- a/Documentation/06 Manual Parsing and Testing.md +++ b/Documentation/06 Manual Parsing and Testing.md @@ -88,7 +88,7 @@ All of the parsing methods — `parse()`, `parseOrExit()`, and `parseAsRoot()` Let's update our `select` script above to strip out any words that contain all capital letters before parsing the inputs. ```swift -let noShoutingArguments = CommandLine.arguments.filter { phrase in +let noShoutingArguments = CommandLine.arguments.dropFirst().filter { phrase in phrase.uppercased() != phrase } let options = SelectOptions.parseOrExit(noShoutingArguments)