Skip to content

Commit

Permalink
Clarify postTerminator parsing strategy behavior (#621)
Browse files Browse the repository at this point in the history
Fixes #597.
  • Loading branch information
natecook1000 authored Mar 5, 2024
1 parent 7191549 commit 3dcbdb0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/ArgumentParser/Parsable Properties/Argument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public struct ArgumentArrayParsingStrategy: Hashable {
self.init(base: .allUnrecognized)
}

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

0 comments on commit 3dcbdb0

Please sign in to comment.