Skip to content

Commit 7e25c00

Browse files
committed
Update docs for flags with default values
It isn't currently mentioned that a `nil` default for a `Bool` flag makes the flag a required input.
1 parent 1d46903 commit 7e25c00

File tree

1 file changed

+3
-2
lines changed
  • Sources/ArgumentParser/Parsable Properties

1 file changed

+3
-2
lines changed

Sources/ArgumentParser/Parsable Properties/Flag.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ extension Flag where Value == Bool {
156156
///
157157
/// - Parameters:
158158
/// - name: A specification for what names are allowed for this flag.
159-
/// - initial: The default value for this flag.
159+
/// - initial: The default value for this flag. If `initial` is `nil`, one
160+
/// of the two inversions is required.
160161
/// - inversion: The method for converting this flags name into an on/off
161162
/// pair.
162163
/// - help: Information about how to use this flag.
@@ -198,7 +199,7 @@ extension Flag where Value: CaseIterable, Value: RawRepresentable, Value.RawValu
198199
/// - Parameters:
199200
/// - name: A specification for what names are allowed for this flag.
200201
/// - initial: A default value to use for this property. If `initial` is
201-
/// non-`nil`, this flag is not required.
202+
/// `nil`, this flag is required.
202203
/// - exclusivity: The behavior to use when multiple flags are specified.
203204
/// - help: Information about how to use this flag.
204205
public init(

0 commit comments

Comments
 (0)