UNPKG

@nestia/sdk

Version:

Nestia SDK and Swagger generator

16 lines (13 loc) 448 B
export namespace CommandParser { export function parse(argList: string[]): Record<string, string> { const output: Record<string, string> = {}; argList.forEach((arg, i) => { if (arg.startsWith("--") === false) return; const key = arg.slice(2); const value: string | undefined = argList[i + 1]; if (value === undefined || value.startsWith("--")) return; output[key] = value; }); return output; } }