-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·41 lines (37 loc) · 1005 Bytes
/
cli.js
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
#!/usr/bin/env node
var args = process.argv.slice(2)
var evm = require('./')
switch (args[0]) {
case 'install':
case 'use':
evm[args[0]]({
version: args[1], platform: args[2], arch: args[3]
}, function (err) {
if (err) console.error(' ' + String(err))
})
break
case 'list':
case 'ls':
evm.curr(function (err, curr) {
evm.list(function (err, items) {
if (err) console.error(' ' + String(err))
var output = items.reduce(function (acc, item) {
return acc + (curr === item[0] ? ' * ' : ' ')
+ item.join(' - ') + '\n'
}, '')
console.log(output)
})
})
break
case 'curr':
evm.curr(function (err, curr) {
if (err) console.error(' ' + String(err))
console.log(curr)
})
break
default:
console.info(' repo: https://github.com/fritx/evm')
console.info(' eg. evm install 1.2.1')
console.info(' eg. evm use 0.33.5')
console.info(' eg. evm ls')
}