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

feat: allow non-array types #106

Open
1 of 3 tasks
privatenumber opened this issue Apr 3, 2021 · 2 comments
Open
1 of 3 tasks

feat: allow non-array types #106

privatenumber opened this issue Apr 3, 2021 · 2 comments

Comments

@privatenumber
Copy link

Issue Type

  • Bug Report
  • Feature Request
  • Other

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:

const cli = cac('cli')
	.option('--size <size>', 'Size', {
		type: String,
	})

and get the parsed options:

{ '--': [], size: '16' }

Actual

Instead, I currently must do

const cli = cac('cli')
	.option('--size <size>', 'Size', {
		type: [String],
	})

and get the parsed options:

{ '--': [], size: ['16'] }

as communicated by the type:

type?: any[]

Possible Solutions

Info

  • CAC version: 6.7.2
  • Reproduction link:
@egoist
Copy link
Collaborator

egoist commented Apr 3, 2021

Ah yes, I actually forgot why it was designed to be an array by default 😅

@Codpoe
Copy link

Codpoe commented Apr 10, 2021

It also confuses me...🤔

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

No branches or pull requests

3 participants