* Shorten home-dir-prefixed paths to ~ notation for the banner. * Not using getDisplayPath() because cwd is the current working directory, * so the relative-path branch would collapse it to the empty string.
(p: string)
| 116 | * so the relative-path branch would collapse it to the empty string. |
| 117 | */ |
| 118 | function tildify(p: string): string { |
| 119 | const home = homedir() |
| 120 | if (p === home) return '~' |
| 121 | if (p.startsWith(home + sep)) return '~' + p.slice(home.length) |
| 122 | return p |
| 123 | } |
no outgoing calls
no test coverage detected