UNPKG

@intuitionrobotics/ts-common

Version:
29 lines (28 loc) 936 B
import { Module } from "../core/module"; import { TypedMap } from "../utils/types"; export type CliParam<K, T extends string | string[] = string> = { keys: string[]; name: string; keyName: K; optional?: true; options?: string[]; defaultValue?: T; isArray?: T extends string[] ? true : never; process?: (value: T) => T; }; type Param = CliParam<string> | CliParam<string, string[]>; type Config = { params: Param[]; }; declare class CliParamsModule_Class extends Module<Config> { private paramsValue; constructor(); init(): TypedMap<string | string[] | undefined>; getParam<T extends string | string[]>(param: CliParam<string, T>, args?: string[]): T; private extractParam; printHowTo: (params: Param[]) => void; private printFoundArgs; getParams: () => TypedMap<string | string[] | undefined>; } export declare const CliParamsModule: CliParamsModule_Class; export {};