Spaces:
Configuration error
Configuration error
Download frontend/src/utils/parse-terminal-output.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/parse-terminal-output.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/utils/parse-terminal-output.ts
-
curl -L -o parse-terminal-output.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/parse-terminal-output.ts
723 Bytes
| /** | |
| * Parses the raw output from the terminal into the command and symbol | |
| * @param raw The raw output to be displayed in the terminal | |
| * @returns The parsed output | |
| * | |
| * @example | |
| * const raw = | |
| * "web_scraper.py\r\n\r\n[Python Interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.12/bin/python]\nopenhands@659478cb008c:/workspace $ "; | |
| * | |
| * const parsed = parseTerminalOutput(raw); | |
| * | |
| * console.log(parsed.output); // web_scraper.py | |
| * console.log(parsed.symbol); // openhands@659478cb008c:/workspace $ | |
| */ | |
| export const parseTerminalOutput = (raw: string) => { | |
| const envRegex = /(.*)\[Python Interpreter: (.*)\]/s; | |
| const match = raw.match(envRegex); | |
| if (!match) return raw; | |
| return match[1]?.trim() || ""; | |
| }; | |