add command line options

pull/7/head
Iuri Matias 6 years ago
parent b64519c81e
commit fe52033e36
  1. 27
      remix-simulator/bin/ethsim
  2. 1
      remix-simulator/package.json
  3. 4
      remix-simulator/src/server.js

@ -1,6 +1,29 @@
#!/usr/bin/env node
const Server = require('../src/server');
const program = require('commander')
const version = require('../package.json').version
program
.command('version')
.description("outputs version number")
.action(() => {
console.log(version)
process.exit(0)
})
program
.command('help')
.description("outputs usage information")
.action(() => {
program.help()
process.exit(0)
})
program
.option('-p, --port [port]', 'specify port')
.parse(process.argv)
const Server = require('../src/server')
const server = new Server()
server.start()
server.start(program.port || 8545)

@ -17,6 +17,7 @@
"ansi-gray": "^0.1.1",
"body-parser": "^1.18.2",
"color-support": "^1.1.3",
"commander": "^2.19.0",
"express": "^4.16.3",
"express-ws": "^4.0.0",
"fast-async": "^6.3.7",

@ -11,7 +11,7 @@ class Server {
this.provider = new Provider()
}
start(host, port) {
start(port) {
expressWs(app)
app.use(bodyParser.urlencoded({extended: true}))
@ -41,7 +41,7 @@ class Server {
})
})
app.listen(8545, () => log('Remix Simulator listening on port 8545!'))
app.listen(port, () => log('Remix Simulator listening on port ' + port))
}
}

Loading…
Cancel
Save