Skip to content
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

Can I prevent yargs .describe feature from showing auto-generated info about type, default, etc? #2153

Closed
BadIdeaException opened this issue Mar 25, 2022 · 4 comments
Assignees

Comments

@BadIdeaException
Copy link

When using yargs .describe method to generate usage information, is there some way to prevent yargs from auto-adding information about type, default value, choices etc.?

I.e. the following

        .option('foo', {
            type: 'string',
            choices: ['bar','baz'],
            required: true,
            default: 'bar',
            description: 'The most important option of all'
        })

results in this output when doing --help:

--foo      The most important option of all      [string] [required] [choices: "bar", "baz"] [default: "bar"]

I have to confess I find that to be a bit ugly, and it is out of line with how help texts are generally formatted in linux. Also, on longer description texts that include line breaks, it breaks formatting.

I haven't found anything in the docs. Is there some way to suppress generation of the bracketed [] parts, without having to completely give up using the describe feature?

@i-siso
Copy link

i-siso commented Oct 4, 2022

@bcoe Thanks for the awesome awesome lib. As mentioned in the issue, and also the open #2156, any update on having this change introduced?
Apart from the programmers, the end users generally don't care about the type or can get confused by the mention of the type in help!

@bcoe
Copy link
Member

bcoe commented Oct 5, 2022

@i-siso thank you 😄

Unfortunately no updates, I've had no spare time I can put towards OSS recently. I think it's just a matter of dusting off @jly36963's PR.

If @jly36963 thinks it's ready, I'm happy to see it land.

@bcoe
Copy link
Member

bcoe commented Dec 28, 2022

There is now an option to turn off type information, implemented in #2156

Additional usage configuration settings can be added as needed. This will be released in the next update to yargs.

@bcoe bcoe closed this as completed Dec 28, 2022
@06000208
Copy link

06000208 commented Jan 29, 2023

Can this feature be released in yargs@next, per the readme? It appears that yargs@next is several versions behind latest, and does not include it as of writing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants