Guillermo Rauch
9 years ago
2 changed files with 16 additions and 1 deletions
@ -0,0 +1,14 @@ |
|||
import { resolve } from 'path'; |
|||
|
|||
// cleaned-up `$HOME` (i.e.: no trailing slash)
|
|||
const HOME = resolve(process.env.HOME); |
|||
|
|||
/** |
|||
* Attempts to show the given path in |
|||
* a human-friendly form. For example, |
|||
* `/Users/rauchg/test.js` becomes `~/test.js` |
|||
*/ |
|||
|
|||
export default function toHumanPath (path) { |
|||
return path.replace(HOME, '~'); |
|||
} |
Loading…
Reference in new issue