Recent Changes

Updates since 1970-01-01 00:00 UTC

(for 2020-05-24_Two_parameters_and_at_least_one_required_in_yargs only)

1 | 3 | 7 | 30 | 90 days
List latest change per page only List only major changes
List later changes RSS RSS with pages RSS with pages and diff

2020-05-24

  • 08:17 UTC (new) 2020-05-24 Two parameters and at least one required in yargs . . . . mbork I happen to write shell scripts in Node.JS quite often. They usually consume some kind of command-line agruments, and my library of choice to parse them is yargs. Recently, I had a situation where there were two parameters and it was required that one of them is given. A bit surprisingly, yargs does not seem to have an option requiredAlternative or something that says “of the following two parameters, at least one must be given” (it has a conflicts method and option, either of which can be used to say “of these two parameters, at most one may be given”, though). Happily, there is a simple way to enforce such a requiement due to the quite general “check” method.

More...

Filters