mirror of
https://github.com/threeal/cmake-action.git
synced 2025-07-02 21:21:21 +00:00
* test: enable strict TypeScript ESLint configuration Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> * test: convert ESLint configuration to TypeScript Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> --------- Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
19 lines
609 B
TypeScript
19 lines
609 B
TypeScript
const regex = /"([^"]*)"|'([^']*)'|`([^`]*)`|(\S+)/g;
|
|
|
|
/**
|
|
* Converts a space-separated string into a list of arguments.
|
|
*
|
|
* This function parses the provided string, which contains arguments separated by spaces and possibly enclosed in quotes, into a list of arguments.
|
|
*
|
|
* @param str - The space-separated string to parse.
|
|
* @returns A list of arguments.
|
|
*/
|
|
export function parse(str: string): string[] {
|
|
const args: string[] = [];
|
|
let match: RegExpExecArray | null;
|
|
while ((match = regex.exec(str)) !== null) {
|
|
args.push(match[1] || match[2] || match[3] || match[4]);
|
|
}
|
|
return args;
|
|
}
|