(target: string)
| 68 | } |
| 69 | |
| 70 | function formatPath(target: string): string { |
| 71 | const relative = path.relative(process.cwd(), target); |
| 72 | |
| 73 | if (relative === "") { |
| 74 | return "."; |
| 75 | } |
| 76 | |
| 77 | if (relative && !relative.startsWith("..") && !path.isAbsolute(relative)) { |
| 78 | return relative; |
| 79 | } |
| 80 | |
| 81 | const absolute = path.resolve(target); |
| 82 | const home = os.homedir(); |
| 83 | const homeWithSep = home.endsWith(path.sep) ? home : `${home}${path.sep}`; |
| 84 | |
| 85 | if (absolute === home) { |
| 86 | return "~"; |
| 87 | } |
| 88 | |
| 89 | if (absolute.startsWith(homeWithSep)) { |
| 90 | const homeRelative = path.relative(home, absolute); |
| 91 | return homeRelative ? `~${path.sep}${homeRelative}` : "~"; |
| 92 | } |
| 93 | |
| 94 | return absolute; |
| 95 | } |
| 96 | |
| 97 | async function processDirectory( |
| 98 | inputDir: string, |
no outgoing calls
no test coverage detected