MCPcopy Create free account
hub / github.com/codeaashu/claude-code / parseTabStatus

Function parseTabStatus

src/ink/termio/osc.ts:349–365  ·  view source on GitHub ↗

* Parse OSC 21337 payload: `key=value;key=value;...` with `\;` and `\\` * escapes inside values. Bare key or `key=` clears that field; unknown * keys are ignored.

(data: string)

Source from the content-addressed store, hash-verified

347 * keys are ignored.
348 */
349function parseTabStatus(data: string): TabStatusAction {
350 const action: TabStatusAction = {}
351 for (const [key, value] of splitTabStatusPairs(data)) {
352 switch (key) {
353 case 'indicator':
354 action.indicator = value === '' ? null : parseOscColor(value)
355 break
356 case 'status':
357 action.status = value === '' ? null : value
358 break
359 case 'status-color':
360 action.statusColor = value === '' ? null : parseOscColor(value)
361 break
362 }
363 }
364 return action
365}
366
367/** Split `k=v;k=v` honoring `\;` and `\\` escapes. Yields [key, unescapedValue]. */
368function* splitTabStatusPairs(data: string): Generator<[string, string]> {

Callers 1

parseOSCFunction · 0.85

Calls 2

splitTabStatusPairsFunction · 0.85
parseOscColorFunction · 0.85

Tested by

no test coverage detected