Skip to content

Commit e2863e6

Browse files
committed
dim tips
1 parent 9b71dc1 commit e2863e6

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/main.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ function _getRandomTip () {
2222
return TIPS[Math.floor(Math.random() * TIPS.length)]
2323
}
2424

25+
function supportsAnsi() {
26+
return process.stdout.isTTY && process.env.TERM !== 'dumb'
27+
}
28+
29+
function dim(text) {
30+
return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text
31+
}
32+
2533
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
2634

2735
// Parse src into an Object
@@ -290,7 +298,7 @@ function configDotenv (options) {
290298
}
291299
}
292300

293-
_log(`injecting env (${keysCount}) from ${shortPaths.join(',')} – [tip] ${_getRandomTip()}`)
301+
_log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`(tip: ${_getRandomTip()})`)}`)
294302
}
295303

296304
if (lastError) {

0 commit comments

Comments
 (0)