UNPKG

@grandlinex/easy-cli

Version:

Cli lib to perform common tasks

42 lines (41 loc) 1.01 kB
import { CMap, CoreLogChannel, CoreLogger } from '@grandlinex/core'; import { IArgs, ParamTypeRaw } from '../lib/types.js'; export default class CliParser extends CoreLogChannel implements IArgs { private readonly parameter; private cmdList; private argV; constructor(logger: CoreLogger, args?: string[]); /** * Convert a string to a value * @param val * @private */ private convertValue; /** * Parse the arguments * @private */ private parse; /** * Get the command list */ getCmdList(): string[]; /** * Get the length of the parameter map */ getLength(): number; /** * Get the parameter map */ getParameters(): CMap<string, ParamTypeRaw>; /** * Get the parameter * @param key */ getParameter<T = ParamTypeRaw | undefined>(key: string): T; /** * Get the null parameter as a boolean * @param key */ getParameterNull(key: string): boolean; }