( raw: RawPipelineElement, )
| 937 | /** Transform a non-CommandAst pipeline element into ParsedCommandElement */ |
| 938 | // exported for testing |
| 939 | export function transformExpressionElement( |
| 940 | raw: RawPipelineElement, |
| 941 | ): ParsedCommandElement { |
| 942 | const elementType: PipelineElementType = |
| 943 | raw.type === 'ParenExpressionAst' |
| 944 | ? 'ParenExpressionAst' |
| 945 | : 'CommandExpressionAst' |
| 946 | const elementTypes: CommandElementType[] = [ |
| 947 | mapElementType(raw.type, raw.expressionType), |
| 948 | ] |
| 949 | |
| 950 | return { |
| 951 | name: raw.text, |
| 952 | nameType: 'unknown', |
| 953 | elementType, |
| 954 | args: [], |
| 955 | text: raw.text, |
| 956 | elementTypes, |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | /** Map raw redirection to ParsedRedirection */ |
| 961 | // exported for testing |
no test coverage detected