Transform the complete raw PS output into ParsedPowerShellCommand
(raw: RawParsedOutput)
| 1104 | |
| 1105 | /** Transform the complete raw PS output into ParsedPowerShellCommand */ |
| 1106 | function transformRawOutput(raw: RawParsedOutput): ParsedPowerShellCommand { |
| 1107 | const result: ParsedPowerShellCommand = { |
| 1108 | valid: raw.valid, |
| 1109 | errors: ensureArray(raw.errors), |
| 1110 | statements: ensureArray(raw.statements).map(transformStatement), |
| 1111 | variables: ensureArray(raw.variables), |
| 1112 | hasStopParsing: raw.hasStopParsing, |
| 1113 | originalCommand: raw.originalCommand, |
| 1114 | } |
| 1115 | const tl = ensureArray(raw.typeLiterals) |
| 1116 | if (tl.length > 0) { |
| 1117 | result.typeLiterals = tl |
| 1118 | } |
| 1119 | if (raw.hasUsingStatements) { |
| 1120 | result.hasUsingStatements = true |
| 1121 | } |
| 1122 | if (raw.hasScriptRequirements) { |
| 1123 | result.hasScriptRequirements = true |
| 1124 | } |
| 1125 | return result |
| 1126 | } |
| 1127 | |
| 1128 | /** |
| 1129 | * Parse a PowerShell command using the native AST parser. |
no test coverage detected