You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
350 B
15 lines
350 B
import {resolve} from 'path'
|
|
import {homedir} from 'os'
|
|
|
|
// cleaned-up `$HOME` (i.e.: no trailing slash)
|
|
const HOME = resolve(homedir())
|
|
|
|
/**
|
|
* 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, '~')
|
|
}
|
|
|