Skip to content

Commit 3dcbdb0

Browse files
authored
Clarify postTerminator parsing strategy behavior (#621)
Fixes #597.
1 parent 7191549 commit 3dcbdb0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Sources/ArgumentParser/Parsable Properties/Argument.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ public struct ArgumentArrayParsingStrategy: Hashable {
188188
self.init(base: .allUnrecognized)
189189
}
190190

191-
/// Before parsing, capture all inputs that follow the `--` terminator in this
192-
/// argument array.
191+
/// Before parsing arguments, capture all inputs that follow the `--`
192+
/// terminator in this argument array.
193193
///
194194
/// For example, the `Example` command defined below has a `words` array that
195195
/// uses the `postTerminator` parsing strategy:
@@ -219,6 +219,14 @@ public struct ArgumentArrayParsingStrategy: Hashable {
219219
/// Error: Unexpected argument 'Extra'
220220
/// ```
221221
///
222+
/// Because options are parsed before arguments, an option that consumes or
223+
/// suppresses the `--` terminator can prevent a `postTerminator` argument
224+
/// array from capturing any input. In particular, the
225+
/// ``SingleValueParsingStrategy/unconditional``,
226+
/// ``ArrayParsingStrategy/unconditionalSingleValue``, and
227+
/// ``ArrayParsingStrategy/remaining`` parsing strategies can all consume
228+
/// the terminator as part of their values.
229+
///
222230
/// - Note: This parsing strategy can be surprising for users, since it
223231
/// changes the behavior of the `--` terminator. Prefer ``remaining``
224232
/// whenever possible.

0 commit comments

Comments
 (0)