75lb/command-line-usage

request: allow for "boolean", "number" and "string"

Closed this issue · 1 comments

Hi, changing this line:

let type = definition.type ? definition.type.name.toLowerCase() : 'string'

only allows usage of:

Boolean
Number
String

but changing it to:

let type = typeof definition.type === "string" ? definition.type.toLowerCase() : definition.type ? definition.type.name.toLowerCase() : 'string'

would allow the usage of all of these:

Boolean
Number
String

"boolean"
"number"
"string"

The first three resolves to the second three anyway so it should not break anything.

This would make this library play perfectly with the meow library without any redundant code.

Thanks

75lb commented

Hi, thanks for the suggestion.. There are many other command line parsing libs, not only meow - they come and go.. it's impossible to make this lib play perfectly with them all without some sort of small adapter layer in between..

If you pass the meow type field into this lib's typeLabel property you should get the behaviour you want..