-
Notifications
You must be signed in to change notification settings - Fork 340
Add --help-hidden for use with _hiddenFromHelp #366
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
Add --help-hidden for use with _hiddenFromHelp #366
Conversation
62ecf2e
to
a7a20b7
Compare
@natecook1000 can you review? |
I think we wanted to explore a more general notion of help "levels", I'm not 100% sure how @natecook1000 wanted to approach this. I was thinking that we could add a extension HelpLevel {
static let experimental = HelpLevel(/*custom string if desired*/)
static let unixCompatibility = HelpLevel()
}
@Option(..., helpLevel: .experimental)
var foo: Int
@Option(..., helpLevel: .unixCompatibility)
var bar: String
// --help (default, provided by sap)
// --help-experimental
// --help-unix-compatibility
// --help-all/everything (provided by sap, created if any levels are used) |
Interesting, yea it sounds like in that case we'd want to remove the current underscored attribute and replace it with one of those. |
Any suggestions in the meantime to fix this for adopters of that feature? I can't blame swiftpm for not wanting to expose all the underlying options by default, but the end result is there's no way to see them without reading source code |
Maybe |
Swift Package Manager adopted _hiddenFromHelp, the resulting help is much more approachable for basic usage, but leaves no way to view all the advanced options it accepts. This takes from swiftc's + clang's playbook and adds a hidden `--help-hidden` flag that prints all help, including those using `_hiddenFromHelp`
a7a20b7
to
4eaec60
Compare
Updated to that for discussion |
Thanks for your patience on this, @keith! Coming back to it, and I think we could just add this directly, without the A few additional questions:
|
didn't see this PR. So I filed #403 :) |
I love the idea of
I think there's a core question here of: should users of this library be able to entirely hide flags from their users? In the current implementation here they cannot. I haven't poked around enough other argument parser to know how common it is to need this. In general as a user of these things I don't like flags being hidden, and would prefer their docs disclaim that they should be "considered private" if necessary, but maybe that's not the right balance. If the custom groups behavior was implemented maybe that would be enough to have a custom group that was never shown to allow this.
Ah yep, sounds like if we go this route it should mirror those, which might be weird if someone was doing something significantly different with the flag, but would probably still be better than having the static one.
Yes great point, we should. Maybe we don't enable this flag at all if there aren't any as well? |
Thanks so much for your work on this, @keith! ❤️ We're going to merge the changes here and iterate a bit before the next release. |
@swift-ci Please test |
🎉 thank you all! |
Sounds good! Thanks everyone |
Swift Package Manager adopted _hiddenFromHelp, the resulting help is
much more approachable for basic usage, but leaves no way to view
all the advanced options it accepts. This takes from swiftc's + clang's
playbook and adds a hidden
--help-hidden
flag that prints all help,including those using
_hiddenFromHelp
Related: https://bugs.swift.org/browse/SR-15224
Checklist