-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathcli.js
More file actions
46 lines (34 loc) · 1.11 KB
/
cli.js
File metadata and controls
46 lines (34 loc) · 1.11 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var argv = require('optimist').argv
const { verbose, isVerbose } = require('./utils/verbose.js')
const operations = {
// 'create': require('./create'),
'help': require('./help'),
'server': require('./server'),
'pm2': require('./pm2'),
'api': require('./api'),
}
const { version } = require('../package.json')
function main() {
try {
console.log('🖥️ evolution-manager CLI: ' + version)
console.log('🖥️ Node: ' + process.version)
verbose('🗣️ Verbose: ' + isVerbose)
verbose('🖥️ Platform: ' + process.platform)
verbose('🖥️ Architecture: ' + process.arch)
verbose('🖥️ PID: ' + process.pid)
verbose('🖥️ CWD: ' + process.cwd())
verbose('🖥️ argv: ' + JSON.stringify(argv))
var operation = argv._[0]
if (!operation) operation = 'help'
if (!operations[operation]) {
console.error(' ⁉️ Unknown operation: ' + operation)
operation = 'help'
}
verbose('🗣️ Running operation: ' + operation)
operations[operation](argv)
} catch (e) {
console.error(e.message || e)
process.exit(1)
}
}
main()