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

Function usePathFormatter

packages/tui/src/context/path-format.tsx:6–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { useTuiPaths } from "./runtime"
5
6export function usePathFormatter() {
7 const paths = useTuiPaths()
8 const location = useLocation()
9 return {
10 path: () => location()?.directory || paths.cwd,
11 format: (input?: string) => formatPath(input, location()?.directory || paths.cwd, paths.home),
12 }
13}
14
15function formatPath(input: string | undefined, base: string, home: string) {
16 if (typeof input !== "string" || !input) return ""

Callers 8

PermissionPromptFunction · 0.90
ShellFunction · 0.90
WriteFunction · 0.90
GlobFunction · 0.90
ReadFunction · 0.90
GrepFunction · 0.90
EditFunction · 0.90
ApplyPatchFunction · 0.90

Calls 4

useTuiPathsFunction · 0.90
useLocationFunction · 0.90
locationFunction · 0.85
formatPathFunction · 0.85

Tested by

no test coverage detected