MCPcopy
hub / github.com/anomalyco/opencode / formatPath

Function formatPath

packages/tui/src/context/path-format.tsx:15–24  ·  view source on GitHub ↗
(input: string | undefined, base: string, home: string)

Source from the content-addressed store, hash-verified

13}
14
15function formatPath(input: string | undefined, base: string, home: string) {
16 if (typeof input !== "string" || !input) return ""
17
18 const absolute = path.isAbsolute(input) ? input : path.resolve(base, input)
19 const relative = path.relative(base, absolute)
20
21 if (!relative) return "."
22 if (relative !== ".." && !relative.startsWith(".." + path.sep)) return relative
23 return abbreviateHome(absolute, home)
24}

Callers 1

usePathFormatterFunction · 0.85

Calls 1

abbreviateHomeFunction · 0.90

Tested by

no test coverage detected