sindresorhus / meow

🐈 CLI app helper
MIT License
3.53k stars 150 forks source link

Is it possible to make input required? #221

Open KonradLinkowski opened 1 year ago

sindresorhus commented 1 year ago

That's not currently possible. It's easy enough to check the input manually and throw an error if it's not valid.

tommy-mitchell commented 1 year ago

Since this is simple to do, it’d make it all the more convenient for meow to support this. It could be an option (like isRequired for flags):

const cli = meow({
  // …
  inputIsRequired: true,
});

I think a simple boolean would be enough, but a function could be accepted like IsRequired for completeness.

sindresorhus commented 1 year ago

We may want more options for the input in the future, so I would go with {input: {isRequired: true}}.