Closed mashaalmemon closed 5 years ago
Hi, the description
property is one of the first things mentioned in the API docs, quote:
Describes a command-line option. Additionally, if generating a usage guide with command-line-usage you could optionally add description and typeLabel properties to each definition.
Yes, that sounds like an issue with the DefinitelyTyped types..
the description
property is required by command-line-usage
, not command-line-args
. It's documented here: https://github.com/75lb/command-line-usage#commandlineusageoptionlist
HI @75lb, you're right. Might be nice to actually have that up at the top of the doc as they are part of the definition like so?:
string
function
string
boolean
boolean
boolean
*
string
| Array.<string>
string
| Array.<string>
(Optional)string
| Array.<string>
(Optional)But I leave it to you. I'll go ahead an submit a pull request to DefinitelyTyped to add these two in the type definitions.
Thanks for the quick response.
Hi, like i said - the description
property is nothing to do with command-line-args
, it's required by command-line-usage
. Ok, yes good idea about the PR, thanks.
@75lb Reading your comments more closely, I realized that OptionDefinition is defined twice, once in the '@types/command-line-args' and again in '@types/command-line-usage'. After your comment, it appears, the best approach is to use the definition from the latter.
Thanks for the clarification.
Hi There,
In docs, there is no mention of the 'description' property of an ObjectDefinition:
https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md#exp_module_option-definition--OptionDefinition
But in the typical example, the 'description' property is used:
https://github.com/75lb/command-line-args/wiki/Typical-usage-example
Docs should be updated.
I noticed this when using this package with Typescript and found I was getting an error when I used 'description' as a property in an 'Option Definition'. Planning to submit a change to the DefinitelyTyped repo to fix this so that the error as well.
Perhaps you can go ahead and fix the docs on this side?