forked from samturrell/gitprefix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
31 lines (26 loc) · 656 Bytes
/
utils.js
File metadata and controls
31 lines (26 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const resolveHome = (path = '') => path.replace('~', process.env.HOME);
const { createLogger, format, transports } = require('winston');
const logger = createLogger({
level: 'info',
transports: [
new transports.Console({
format: format.combine(
format.colorize(),
format.simple()
),
})
]
});
function execute(command) {
const { exec } = require('child_process');
return new Promise((resolve) => {
exec(command, function(error, stdout) {
resolve(stdout);
});
})
}
module.exports = {
resolveHome,
logger,
execute,
};