( parsed: ParsedPowerShellCommand, )
| 1484 | * Useful for checking each command independently. |
| 1485 | */ |
| 1486 | export function getAllCommands( |
| 1487 | parsed: ParsedPowerShellCommand, |
| 1488 | ): ParsedCommandElement[] { |
| 1489 | const commands: ParsedCommandElement[] = [] |
| 1490 | for (const statement of parsed.statements) { |
| 1491 | for (const cmd of statement.commands) { |
| 1492 | commands.push(cmd) |
| 1493 | } |
| 1494 | if (statement.nestedCommands) { |
| 1495 | for (const cmd of statement.nestedCommands) { |
| 1496 | commands.push(cmd) |
| 1497 | } |
| 1498 | } |
| 1499 | } |
| 1500 | return commands |
| 1501 | } |
| 1502 | |
| 1503 | /** |
| 1504 | * Get all redirections across all statements. |
no test coverage detected