-
Notifications
You must be signed in to change notification settings - Fork 343
Hide option group with new OptionGroup constructor #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
22bec4a
to
74f3470
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start @miggs597! 👏🏻 Added some notes about a different way to do this that will let us avoid using the description
property.
return "OptionGroup(*definition*)" | ||
} | ||
} | ||
} | ||
|
||
extension OptionGroup { | ||
public init(_hidden: Bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment here that says what this does and includes (Experimental)
? Just want to hint that people shouldn't actually use this, even though it's public.
@@ -31,6 +31,7 @@ | |||
@propertyWrapper | |||
public struct OptionGroup<Value: ParsableArguments>: Decodable, ParsedWrapper { | |||
internal var _parsedValue: Parsed<Value> | |||
internal var _hidden: Bool? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have this be non-optional, and just default to false
. Can you call it something like _hiddenFromHelp
?
if let hidden = _hidden { | ||
return "OptionGroup(*definition*) _hidden: \(hidden)" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but we don't really want to pass configuration values through this type's string representation. Instead, let's add var _hiddenFromHelp: Bool { get }
as a protocol requirement in ArgumentSetProvider
, here: https://github.com/apple/swift-argument-parser/blob/main/Sources/ArgumentParser/Parsable%20Types/ParsableArguments.swift#L230
You can add a default implementation that always returns false
, and then this type will have the customized version, defined above.
@swift-ci Please test |
Are we ready to merge @natecook1000? |
Looks good to me! 🎉 |
Second PR that is needed to fix --help for SwiftPM
Related PRs:
SwiftPM
ArgumentParser
Checklist