(command: string)
| 98 | } |
| 99 | |
| 100 | function tokenizeCommand(command: string) { |
| 101 | const tokens: string[] = []; |
| 102 | const regex = /"([^"]*)"|'([^']*)'|`([^`]*)`|(\S+)/g; |
| 103 | let match: RegExpExecArray | null = regex.exec(command); |
| 104 | while (match) { |
| 105 | const [, doubleQuoted, singleQuoted, backticked, bare] = match; |
| 106 | const value = doubleQuoted ?? singleQuoted ?? backticked ?? bare ?? ""; |
| 107 | if (value) { |
| 108 | tokens.push(value); |
| 109 | } |
| 110 | match = regex.exec(command); |
| 111 | } |
| 112 | return tokens; |
| 113 | } |
| 114 | |
| 115 | function splitCommandSegments(command: string) { |
| 116 | return command |
no outgoing calls
no test coverage detected