Browse Source
Show proper shell mark depending on user
pull/394/head
BrainStone
4 years ago
No known key found for this signature in database
GPG Key ID: 66CCC234C2CEB306
1 changed files with
4 additions and
2 deletions
-
src/lib/Util.js
|
|
|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
const childProcess = require('child_process'); |
|
|
|
|
|
|
|
const shellSymbol = (process.getuid() === 0) ? '#' : '$'; |
|
|
|
|
|
|
|
module.exports = class Util { |
|
|
|
|
|
|
|
static isValidIPv4(str) { |
|
|
|
@ -57,10 +59,10 @@ module.exports = class Util { |
|
|
|
} = {}) { |
|
|
|
if (typeof log === 'string') { |
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log(`$ ${log}`); |
|
|
|
console.log(`${shellSymbol} ${log}`); |
|
|
|
} else if (log === true) { |
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log(`$ ${cmd}`); |
|
|
|
console.log(`${shellSymbol} ${cmd}`); |
|
|
|
} |
|
|
|
|
|
|
|
if (process.platform !== 'linux') { |
|
|
|
|