( parsed: ParsedPowerShellCommand, )
| 1505 | */ |
| 1506 | // exported for testing |
| 1507 | export function getAllRedirections( |
| 1508 | parsed: ParsedPowerShellCommand, |
| 1509 | ): ParsedRedirection[] { |
| 1510 | const redirections: ParsedRedirection[] = [] |
| 1511 | for (const statement of parsed.statements) { |
| 1512 | for (const redir of statement.redirections) { |
| 1513 | redirections.push(redir) |
| 1514 | } |
| 1515 | // Include redirections from nested commands (e.g., from && / || chains) |
| 1516 | if (statement.nestedCommands) { |
| 1517 | for (const cmd of statement.nestedCommands) { |
| 1518 | if (cmd.redirections) { |
| 1519 | for (const redir of cmd.redirections) { |
| 1520 | redirections.push(redir) |
| 1521 | } |
| 1522 | } |
| 1523 | } |
| 1524 | } |
| 1525 | } |
| 1526 | return redirections |
| 1527 | } |
| 1528 | |
| 1529 | /** |
| 1530 | * Get all variables, optionally filtered by scope (e.g., 'env'). |
no test coverage detected