(raw)
| 74 | } |
| 75 | |
| 76 | function primaryCommand(raw) { |
| 77 | const input = String(raw || '').trim(); |
| 78 | if (!input) { |
| 79 | return 'none'; |
| 80 | } |
| 81 | const pieces = input.split(/&&|\|\|/).map((piece) => piece.trim()).filter(Boolean); |
| 82 | const target = pieces.find((piece) => !/^cd\s+/.test(piece)) || pieces[0] || input; |
| 83 | if (target.startsWith('python - <<')) { |
| 84 | return 'python-heredoc'; |
| 85 | } |
| 86 | if (target.startsWith('printf ')) { |
| 87 | return 'printf'; |
| 88 | } |
| 89 | const match = target.match(/^([A-Za-z0-9._/-]+)/); |
| 90 | return match ? match[1] : shortText(target, 40); |
| 91 | } |
| 92 | |
| 93 | function parseExitCode(text) { |
| 94 | const match = String(text || '').match(/(?:Return code:|Process exited with code|<exited with exit code)\s*(-?\d+)/i); |
no test coverage detected