()
| 4 | import { useTuiPaths } from "./runtime" |
| 5 | |
| 6 | export 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 | |
| 15 | function formatPath(input: string | undefined, base: string, home: string) { |
| 16 | if (typeof input !== "string" || !input) return "" |
no test coverage detected