Download packages/tui/src/context/directory.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 567 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/context/directory.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/src/context/directory.ts
-
curl -L -o directory.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/context/directory.ts
567 Bytes
| import { createMemo } from "solid-js" | |
| import { useProject } from "./project" | |
| import { useSync } from "./sync" | |
| import { abbreviateHome } from "../runtime" | |
| import { useTuiPaths } from "./runtime" | |
| export function useDirectory() { | |
| const project = useProject() | |
| const sync = useSync() | |
| const paths = useTuiPaths() | |
| return createMemo(() => { | |
| const directory = project.instance.path().directory || paths.cwd | |
| const result = abbreviateHome(directory, paths.home) | |
| if (sync.data.vcs?.branch) return result + ":" + sync.data.vcs.branch | |
| return result | |
| }) | |
| } | |