UNPKG

@mail-core/cli

Version:

Инструментарий для написания cli-скриптов

24 lines (23 loc) 949 B
import { Options, Arguments, InferredOptionTypes, PositionalOptions, InferredOptionType } from 'yargs'; export declare type Option = Options & { interactive?: true; } | PositionalOptions & { positional: true; interactive?: true; }; export interface OptionWithArg extends Options { name: string; value: InferredOptionType<this>; } declare type AddOptionArg<T extends Options> = T & { name: string; value: InferredOptionType<T>; }; export declare type OptionsMap = Record<string, Option>; export declare type OptionWithArgMap<M extends OptionsMap> = { [K in keyof M]: AddOptionArg<M[K]>; }; export declare type Argv<O extends OptionsMap> = Arguments<InferredOptionTypes<O>>; export declare function parseArgv<O extends OptionsMap>(_: O, argv: string[]): Arguments<InferredOptionTypes<O>>; export declare function parseArgvString<O extends OptionsMap>(_: O, value: string): Arguments<InferredOptionTypes<O>>; export {};