| 40 | * Exported for testing purposes. |
| 41 | */ |
| 42 | export class RegexParsedCommand_DEPRECATED implements IParsedCommand { |
| 43 | readonly originalCommand: string |
| 44 | |
| 45 | constructor(command: string) { |
| 46 | this.originalCommand = command |
| 47 | } |
| 48 | |
| 49 | toString(): string { |
| 50 | return this.originalCommand |
| 51 | } |
| 52 | |
| 53 | getPipeSegments(): string[] { |
| 54 | try { |
| 55 | const parts = splitCommandWithOperators(this.originalCommand) |
| 56 | const segments: string[] = [] |
| 57 | let currentSegment: string[] = [] |
| 58 | |
| 59 | for (const part of parts) { |
| 60 | if (part === '|') { |
| 61 | if (currentSegment.length > 0) { |
| 62 | segments.push(currentSegment.join(' ')) |
| 63 | currentSegment = [] |
| 64 | } |
| 65 | } else { |
| 66 | currentSegment.push(part) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (currentSegment.length > 0) { |
| 71 | segments.push(currentSegment.join(' ')) |
| 72 | } |
| 73 | |
| 74 | return segments.length > 0 ? segments : [this.originalCommand] |
| 75 | } catch { |
| 76 | return [this.originalCommand] |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | withoutOutputRedirections(): string { |
| 81 | if (!this.originalCommand.includes('>')) { |
| 82 | return this.originalCommand |
| 83 | } |
| 84 | const { commandWithoutRedirections, redirections } = |
| 85 | extractOutputRedirections(this.originalCommand) |
| 86 | return redirections.length > 0 |
| 87 | ? commandWithoutRedirections |
| 88 | : this.originalCommand |
| 89 | } |
| 90 | |
| 91 | getOutputRedirections(): OutputRedirection[] { |
| 92 | const { redirections } = extractOutputRedirections(this.originalCommand) |
| 93 | return redirections |
| 94 | } |
| 95 | |
| 96 | getTreeSitterAnalysis(): TreeSitterAnalysis | null { |
| 97 | return null |
| 98 | } |
| 99 | } |
nothing calls this directly
no outgoing calls
no test coverage detected