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
Feature Request: ability to hide options #1106
Comments
A challenge with additions to The issue I have with the A different idea, but a bit clumsy, is a separate call to supply the extra settings:
Similar past issue: #811 |
Exploring a couple of builder patterns for extending functionality, which might fit in with Commander chaining style. Inline builder:
And a more conventional builder which returns an Option:
|
I think the builder patterns provide a distinctly extensible direction that I think it could tie into your "clumsy" suggestion as an "under the hood" kind of thing for the time being and then there could be a full release that uses chainable builders both under the hood or explicitly for more future control |
Still exploring interface ideas. A simple way to expose a low-level extensible interface for less common use cases might be:
|
I think that the more conventional builder would be the most flexible and allow for people to get as creative as possible while staying SOLID. The conventional pattern helps separate concerns because the exported option manages its own logic.
|
Good comment about separation of concerns. I have been thinking too much about the Command end, but there is already an Option which may be sufficient without a separate builder.
(And the |
Sorry for the major delay! The holidays and work travel have made things crazy. I like that! (Although, I think that optional |
I also would really love this feature. |
Not a bad idea @benoitlamarche , but the option description is not required and for simple cases quite reasonable to omit. That would be a breaking change in behaviour. |
Experimenting with Option approach in #1331: program
.addOption(new Option('-s, --secret').hideHelp()) |
Included in v7.0.0 pre-release #1386 |
Included in Commander 7.0.0. |
Ask:
Provide a
.noHelp()
command for an option to opt-out of the default help generation or update the.allowUnknownOptions
command to take a list of accepted "unknown" options and store any of those which are passed somewhere within the program for access.Context:
Currently, there is no ability to hide options other than to manually parse
process.argv
in search of the specific options that you want and then strip those out of what you pass toprogram.parse
.I am working on an internally open-sourced CLI that takes advantage of feature flags to determine whether a command is in development, beta, production, or deprecated. The CLI is dynamically populated with the available commands depending on the user's self-declared "level" in a configuration file.
Use 1
In order to make our testing more robust, we'd like to be able to pass
--[dev|beta|prod]
in on the command line that will override that configuration file, making it so that we need fewer configuration files in order to run integration and e2e tests on the full suite.Use 2:
Once we integrate with the API that is in development, we will want to pass a
--test [endpoint]
flag to the code during e2e tests to inform it that it needs to use that specific endpoint for the test-session and the test-specific headers that are required for a test session.The text was updated successfully, but these errors were encountered: