Skip to content
Myr

Feature/argument arg explicit (#1567)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add new methods * Add chain test * Add tests for Argument.required * Add typings for argRequired and argOptional

authored by John Gee · committed by GitHub · parent 4be69f1 · Browse files · 5 files+77 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+77 added−0 removed

  • tests:+46 added−0 removed
  • other:+31 added−0 removed

5 files+77 added−0 removed

modified:lib/argument.js+16 added
modified:tests/argument.chain.test.js+12 added
added:tests/argument.required.test.js+34 added
modified:typings/index.d.ts+9 added
61 unmodified lines
62 * Only allow argument value to be one of choices.63 */64 choices(values: string[]): this;6566 /**67 * Make option-argument required.68 */69 argRequired(): this;7071 /**72 * Make option-argument optional.73 */74 argOptional(): this;75 }7677export class Option {78 flags: string;
680 unmodified lines
modified:typings/index.test-d.ts+6 added
393 unmodified lines
394395// choices396expectType<commander.Argument>(baseArgument.choices(['a', 'b']));397398// argRequired399expectType<commander.Argument>(baseArgument.argRequired());400401// argOptional402expectType<commander.Argument>(baseArgument.argOptional());403404// createArgument405expectType<commander.Argument>(program.createArgument('<name>'));406expectType<commander.Argument>(program.createArgument('<name>', 'description'));