UNPKG

773 BTypeScriptView Raw
1interface CommandData {
2 [key: string]: string;
3}
4
5interface TypeDefs {
6 [key: string]: TypeInfo;
7}
8
9interface TypeInfo {
10 type: Object;
11 validate: (data: CommandData, k: string, val: string) => boolean;
12}
13
14declare namespace nopt {
15 export function clean(data: CommandData, types: FlagTypeMap, typeDefs?: TypeDefs): string;
16 export var typeDefs: TypeDefs;
17}
18
19interface FlagTypeMap {
20 [k: string]: Object;
21}
22
23interface ShortFlags {
24 [k: string]: string[] | string;
25}
26
27declare function nopt(types: FlagTypeMap, shorthands?: ShortFlags, args?: string[], slice?: number): OptionsParsed;
28
29interface OptionsParsed {
30 [k: string]: any;
31 argv: {
32 remain: string[];
33 cooked: string[];
34 original: string[];
35 };
36}
37
38export = nopt;