spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / telemetry / hooks / context / linux-distro-of / os-release-value / os-release-value.ts
14 lines · 430 BRaw
1/**
2 * One key's value in an os-release file, unquoted; undefined when the file
3 * has no such line.
4 *
5 * @param content the file's text
6 * @param key the key
7 * @returns the value, or undefined
8 */
9export const osReleaseValue = (content: string, key: 'ID' | 'VERSION_ID') =>
10 content
11 .split('\n')
12 .map(line => /^(ID|VERSION_ID)=(.*)$/.exec(line))
13 .find(match => match?.[1] === key)?.[2]
14 ?.replace(/^"|"$/g, '')