1 | import { Arg } from './args';
|
2 | import * as Flags from './flags';
|
3 | import { Metadata } from './metadata';
|
4 | export declare type OutputArgs = {
|
5 | [name: string]: any;
|
6 | };
|
7 | export declare type OutputFlags<T extends ParserInput['flags']> = {
|
8 | [P in keyof T]: any;
|
9 | };
|
10 | export declare type ParserOutput<TFlags extends OutputFlags<any>, TArgs extends OutputArgs> = {
|
11 | flags: TFlags;
|
12 | args: TArgs;
|
13 | argv: string[];
|
14 | raw: ParsingToken[];
|
15 | metadata: Metadata;
|
16 | };
|
17 | export declare type ArgToken = {
|
18 | type: 'arg';
|
19 | input: string;
|
20 | };
|
21 | export declare type FlagToken = {
|
22 | type: 'flag';
|
23 | flag: string;
|
24 | input: string;
|
25 | };
|
26 | export declare type ParsingToken = ArgToken | FlagToken;
|
27 | export interface ParserInput {
|
28 | argv: string[];
|
29 | flags: Flags.Input<any>;
|
30 | args: Arg<any>[];
|
31 | strict: boolean;
|
32 | context: any;
|
33 | '--'?: boolean;
|
34 | }
|
35 | export declare class Parser<T extends ParserInput, TFlags extends OutputFlags<T['flags']>, TArgs extends OutputArgs> {
|
36 | private readonly input;
|
37 | private readonly argv;
|
38 | private readonly raw;
|
39 | private readonly booleanFlags;
|
40 | private readonly context;
|
41 | private readonly metaData;
|
42 | private currentFlag?;
|
43 | constructor(input: T);
|
44 | parse(): {
|
45 | args: TArgs;
|
46 | argv: any[];
|
47 | flags: TFlags;
|
48 | raw: ParsingToken[];
|
49 | metadata: any;
|
50 | };
|
51 | private _args;
|
52 | private _flags;
|
53 | private _argv;
|
54 | private _debugOutput;
|
55 | private _debugInput;
|
56 | private get _argTokens();
|
57 | private get _flagTokens();
|
58 | private _setNames;
|
59 | }
|