UNPKG

@pubby/sdk

Version:
44 lines (43 loc) 1.17 kB
export declare type TypeDef = { name: string; find(textRef: TextRef): any; rest(textRef: TextRef): any; }; export interface Arg { name: string; type: TypeDef; typeArg: string; rest: boolean; required: boolean; } export interface Command { commands: string[]; default: string; } export declare class MissingParameterError extends Error { param: string; constructor(param: string); } export declare function regexpFinder(regex: RegExp, normalizer?: (text: string) => any): (textRef: TextRef) => any; export declare class TextRef { text: string; constructor(text: string); consume(count: number): this; trim(): this; toString(): string; } export declare class ParamsString { types: Record<string, TypeDef>; constructor(types: Record<string, TypeDef>); private parseArg; private defaultRestMatcher; typedef(type: Omit<TypeDef, "rest"> & { rest?(textRef: TextRef): any; }): this; private parseArgs; private parseText; getCommand(usage: string, input: string): { command: string; args: any; }; }