Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/ts-command-line > CommandLineChoiceParameter > appendToArgList

CommandLineChoiceParameter.appendToArgList() method

Append the parsed values to the provided string array.


/** @override */
appendToArgList(argList: string[]): void;


argListstring[]the parsed strings will be appended to this string array




Sometimes a command line parameter is not used directly, but instead gets passed through to another tool that will use it. For example if our parameter comes in as "--max-count 3", then we might want to call child_process.spawn() and append ["--max-count", "3"] to the args array for that tool. appendToArgList() appends zero or more strings to the provided array, based on the input command-line that we parsed.

If the parameter was omitted from our command-line and has no default value, then nothing will be appended. If the short name was used, the long name will be appended instead.