MCPcopy Create free account
hub / github.com/anomalyco/opencode / abbreviateHome

Function abbreviateHome

packages/tui/src/runtime.tsx:3–9  ·  view source on GitHub ↗
(input: string, home: string)

Source from the content-addressed store, hash-verified

1import path from "path"
2
3export function abbreviateHome(input: string, home: string) {
4 if (!home) return input
5 const relative = path.relative(home, input)
6 if (relative === "") return "~"
7 if (relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) return input
8 return "~" + path.sep + relative
9}

Callers 6

runtime.test.tsxFile · 0.90
DialogMoveSessionFunction · 0.90
formatPathFunction · 0.90
useDirectoryFunction · 0.90
ViewFunction · 0.90
DirectoryFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected