Open privatenumber opened 3 years ago
I'd like to be able to just specify a type (eg. String), without making it an array String (eg. [String])
String
[String]
I'd like to be able to do:
const cli = cac('cli') .option('--size <size>', 'Size', { type: String, })
and get the parsed options:
{ '--': [], size: '16' }
Instead, I currently must do
const cli = cac('cli') .option('--size <size>', 'Size', { type: [String], })
{ '--': [], size: ['16'] }
as communicated by the type: https://github.com/cacjs/cac/blob/f51fc2254d7ea30b4faea76f69f52fe291811e4f/src/Option.ts#L5
Ah yes, I actually forgot why it was designed to be an array by default 😅
It also confuses me...🤔
Issue Type
Expected
I'd like to be able to just specify a type (eg.
String
), without making it an array String (eg.[String]
)I'd like to be able to do:
and get the parsed options:
Actual
Instead, I currently must do
and get the parsed options:
as communicated by the type: https://github.com/cacjs/cac/blob/f51fc2254d7ea30b4faea76f69f52fe291811e4f/src/Option.ts#L5
Possible Solutions
Info