Yargs: separate demand into demandOption and demandCommand

Created on 16 May 2016  路  3Comments  路  Source: yargs/yargs

As @ljharb was fixing #431 with #438 , we've discovered a bit of a black hole that is demand.

The suggested solution at this point is to work off demand being separated in to two different functions: demandOption and demandCommand, clear detailed in this comment.

I am currently working on separating the two. To avoid breaking too many things, I am hoping to keep both require and demand as a alias for demandOption until we decide to completely get rid of demand.

Let's use this thread to track any discussion we might have about demand and the proposed separation.

Help Wanted

Most helpful comment

This sounds good to me. I was pointed this way because I was trying to do demand(0, 0) to throw an error when extraneous arguments are provided. I agree that demand() could do with a split.

It's sort of a nit-pick but I would call demandCommand() demandArg() instead because not all arguments are commands (they could be file paths, etc).

All 3 comments

This sounds good to me. I was pointed this way because I was trying to do demand(0, 0) to throw an error when extraneous arguments are provided. I agree that demand() could do with a split.

It's sort of a nit-pick but I would call demandCommand() demandArg() instead because not all arguments are commands (they could be file paths, etc).

@bcoe @nexdrew @maxrimue you _won't_ believe this, buttttttt I actually had time to work this separation out this weekend. lmk if y'all think this might still be useful, and I'll PR a WIP branch before I do anything else \o/

@lrlna That's awesome 馃帀! I do think this still would be useful, so go ahead!

Was this page helpful?
0 / 5 - 0 ratings