Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 38x 38x 38x 266x 266x 266x 266x | import { Command, Option } from 'commander'; export const addOptions = (command: Command, options: Option[]) => { for (const option of options) command.addOption(option); return command; }; export const newOption = <T>( flags: string, description: string, envName: string, argParser?: (value: string, previous: T) => T, defaultValue?: unknown ) => { const option = new Option(flags, description).env(envName); if (argParser !== undefined) option.argParser(argParser); if (defaultValue !== undefined) option.default(defaultValue); return option; }; |