(path: string)
| 85 | } |
| 86 | |
| 87 | export function formatPathForPrompt(path: string): string { |
| 88 | const home = resolve(homedir()); |
| 89 | const resolvedPath = resolve(path); |
| 90 | |
| 91 | if (resolvedPath === home) return "~"; |
| 92 | if (resolvedPath.startsWith(`${home}${sep}`)) { |
| 93 | return `~/${resolvedPath.slice(home.length + 1).split(sep).join("/")}`; |
| 94 | } |
| 95 | |
| 96 | return resolvedPath.split(sep).join("/"); |
| 97 | } |
no outgoing calls
no test coverage detected