DefinitelyTyped/types/yargs-parser/index.d.ts
Steffen Viken Valvåg a0601f9802 yargs: Fall back to unknown for unknown arguments,
and enable demand/demandOption to come before the option definition. Still fall back to any in yargs-parser (removing the dependency from yargs-parser on yargs).
2018-12-21 08:45:09 +01:00

64 lines
1.9 KiB
TypeScript

// Type definitions for yargs-parser 11.0
// Project: https://github.com/yargs/yargs-parser#readme
// Definitions by: Miles Johnson <https://github.com/milesj>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace yargsParser {
interface Arguments {
/** Non-option arguments */
_: string[];
/** The script name or node command */
$0: string;
/** All remaining options */
[argName: string]: any;
}
interface DetailedArguments {
argv: Arguments;
error: Error | null;
aliases: { [alias: string]: string[] };
newAliases: { [alias: string]: boolean };
configuration: Configuration;
}
interface Configuration {
'boolean-negation': boolean;
'camel-case-expansion': boolean;
'combine-arrays': boolean;
'dot-notation': boolean;
'duplicate-arguments-array': boolean;
'flatten-duplicate-arrays': boolean;
'negation-prefix': string;
'parse-numbers': boolean;
'populate--': boolean;
'set-placeholder-key': boolean;
'short-option-groups': boolean;
}
interface Options {
alias?: { [key: string]: string | string[] };
array?: string[];
boolean?: string[];
config?: string | string[] | { [key: string]: boolean };
configuration?: Partial<Configuration>;
coerce?: { [key: string]: (arg: any) => any };
count?: string[];
default?: { [key: string]: any };
envPrefix?: string;
narg?: { [key: string]: number };
normalize?: string[];
string?: string[];
number?: string[];
'--'?: boolean;
}
interface Parser {
(argv: string | string[], opts?: Options): Arguments;
detailed(argv: string | string[], opts?: Options): DetailedArguments;
}
}
declare var yargsParser: yargsParser.Parser;
export = yargsParser;