feat: Add Flag.withHidden to hide flags from help output#2
Open
avallete wants to merge 10 commits into
Open
Conversation
…directly with `asserts(schema, input)` and remove `Schema.Codec.ToAsserts` (Effect-TS#2221)
Co-authored-by: Tim Smart <hello@timsmart.co>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Adds `Flag.withHidden` (and underlying `Param.withHidden`) so flags can parse normally on the command line while being omitted from `--help` output, shared/global flag listings, and shell completion descriptors. This is useful for experimental, internal, or deprecated flags such as `--experimental-foo`, debug toggles, or escape hatches that should be accepted but not yet advertised on the public CLI surface.
…, drop unused FlagDoc.hidden - Filter hidden flags from suggestion candidates in createUnrecognizedFlagError so a typo cannot leak a hidden flag name. - Remove the unused `hidden` field from `HelpDoc.FlagDoc` — buildHelpDoc filters hidden flags out before constructing FlagDocs, so the field was dead weight on the public API surface. - Add a regression test for the suggestion filter.
a8526c6 to
06a4fd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
Flag.withHidden(andParam.withHidden) to hide flags from--helpoutput and shell completions while keeping them fully parseable on the command line. This is useful for experimental, internal, or deprecated flags that should be accepted but not advertised.Key Changes
hidden: booleanproperty toParam.SingleinterfaceParam.withHiddencombinator to mark parameters as hiddenFlag.withHiddenas a convenience wrapper aroundParam.withHiddenhelp.tscommand.tsdescriptor.tsparser.tsImplementation Details
hiddenproperty defaults tofalsefor backward compatibilityhttps://claude.ai/code/session_01Eurf2SqBb8vNgcCiqLaokP