Skip to content
Myr

Add more Option and Argument properties to typings (#2019)

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

authored by John Gee · committed by GitHub · parent 26a34e6 · Browse files · 2 files+26 added−2 removed
This commit

State

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

Diff stats

2 files+26 added−2 removed

  • other:+26 added−2 removed

2 files+26 added−2 removed

modified:typings/index.d.ts+5 added
48 unmodified lines
49export class Argument {50 description: string;51 required: boolean;52 variadic: boolean;53 defaultValue?: any;54 defaultValueDescription?: string;55 argChoices?: string[];5657 /**58 * Initialize a new command argument with the given name and description.59 * The default is that the argument is required, and you can explicitly
44 unmodified lines
104 long?: string;105 negate: boolean;106 defaultValue?: any;107 defaultValueDescription?: string;108 presetArg?: unknown;109 envVar?: string;110 parseArg?: <T>(value: string, previous: T) => T;111 hidden: boolean;112 argChoices?: string[];113
771 unmodified lines
modified:typings/index.test-d.ts+21 added-2 removed
396 unmodified lines
397expectType<string>(helper.wrap('a b c', 50, 3));398399expectType<string>(helper.formatHelp(helperCommand, helper));400401// Option methods402401// Option properties402const baseOption = new commander.Option('-f,--foo', 'foo description');403expectType<string>(baseOption.flags);404expectType<string>(baseOption.description);405expectType<boolean>(baseOption.required);406expectType<boolean>(baseOption.optional);407expectType<boolean>(baseOption.variadic);408expectType<boolean>(baseOption.mandatory);409expectType<string | undefined>(baseOption.short);410expectType<string | undefined>(baseOption.long);411expectType<boolean>(baseOption.negate);412expectType<any>(baseOption.defaultValue);413expectType<string | undefined>(baseOption.defaultValueDescription);414expectType<unknown>(baseOption.presetArg);415expectType<string | undefined>(baseOption.envVar);416expectType<boolean>(baseOption.hidden);417expectType<string[] | undefined>(baseOption.argChoices);418419// Option methods420421// default422expectType<commander.Option>(baseOption.default(3));423expectType<commander.Option>(baseOption.default(60, 'one minute'));424
44 unmodified lines
469const baseArgument = new commander.Argument('<foo');470expectType<string>(baseArgument.description);471expectType<boolean>(baseArgument.required);472expectType<boolean>(baseArgument.variadic);473expectType<any>(baseArgument.defaultValue);474expectType<string | undefined>(baseArgument.defaultValueDescription);475expectType<string[] | undefined>(baseArgument.argChoices);476477// Argument methods478479// name
23 unmodified lines