| 173 | } |
| 174 | |
| 175 | function extractEnvVars(commandNode: Node | null): string[] { |
| 176 | if (!commandNode || commandNode.type !== 'command') return [] |
| 177 | |
| 178 | const envVars: string[] = [] |
| 179 | for (const child of commandNode.children) { |
| 180 | if (child.type === 'variable_assignment') { |
| 181 | envVars.push(child.text) |
| 182 | } else if (child.type === 'command_name' || child.type === 'word') { |
| 183 | break |
| 184 | } |
| 185 | } |
| 186 | return envVars |
| 187 | } |
| 188 | |
| 189 | export function extractCommandArguments(commandNode: Node): string[] { |
| 190 | // Declaration commands |