This Python script turns the fairly human-oriented output of code --status (from Visual Studio Code) into a structured JSON object that tools can consume. It works on Windows, macOS, and Linux, and it can either read the code --status text from standard input or execute the command itself if no input is provided.
-
Input handling
- If data is piped in (
code --status | python parse_vscode_status.py), it uses that.
- If data is piped in (
- If not, it runs
code --statusviasubprocess. On Windows, it tries multiple decoders (utf-8,cp932,mbcs) and falls back to a replacement strategy to avoid crashes from encoding issues.