add more cmd line options to sim
This commit is contained in:
parent
33adaf360b
commit
174ba8ec9b
16
lib/cmd.js
16
lib/cmd.js
|
@ -106,7 +106,7 @@ class Cmd {
|
||||||
blockchain() {
|
blockchain() {
|
||||||
program
|
program
|
||||||
.command('blockchain [environment]')
|
.command('blockchain [environment]')
|
||||||
.option('-c, --client [client]', 'Use a specific ethereum client or simulator (supported: geth, parity, ethersim, testrpc')
|
.option('-c, --client [client]', 'Use a specific ethereum client or simulator (supported: geth, testrpc')
|
||||||
.description('run blockchain server (default: development)')
|
.description('run blockchain server (default: development)')
|
||||||
.action(function (env, options) {
|
.action(function (env, options) {
|
||||||
embark.initConfig(env || 'development', {
|
embark.initConfig(env || 'development', {
|
||||||
|
@ -122,14 +122,24 @@ class Cmd {
|
||||||
.command('simulator [environment]')
|
.command('simulator [environment]')
|
||||||
.description('run a fast ethereum rpc simulator')
|
.description('run a fast ethereum rpc simulator')
|
||||||
.option('--testrpc', 'use testrpc as the rpc simulator [default]')
|
.option('--testrpc', 'use testrpc as the rpc simulator [default]')
|
||||||
.option('-p, --port [port]', 'port to run the rpc simulator (default: 8000)')
|
.option('-p, --port [port]', 'port to run the rpc simulator (default: 8545)')
|
||||||
.option('-h, --host [host]', 'host to run the rpc simulator (default: localhost)')
|
.option('-h, --host [host]', 'host to run the rpc simulator (default: localhost)')
|
||||||
|
.option('-a, --accounts [numAccounts]', 'number of accounts (default: 10)')
|
||||||
|
.option('-e, --defaultBalanceEther [balance]', 'Amount of ether to assign each test account (default: 100)')
|
||||||
|
.option('-l, --gasLimit [gasLimit]', 'custom gas limit (default: 8000000)')
|
||||||
|
|
||||||
.action(function (env, options) {
|
.action(function (env, options) {
|
||||||
embark.initConfig(env || 'development', {
|
embark.initConfig(env || 'development', {
|
||||||
embarkConfig: 'embark.json',
|
embarkConfig: 'embark.json',
|
||||||
interceptLogs: false
|
interceptLogs: false
|
||||||
});
|
});
|
||||||
embark.simulator({port: options.port, host: options.host});
|
embark.simulator({
|
||||||
|
port: options.port,
|
||||||
|
host: options.host,
|
||||||
|
numAccounts: options.numAccounts,
|
||||||
|
defaultBalance: options.balance,
|
||||||
|
gasLimit: options.gasLimit
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,9 @@ class Simulator {
|
||||||
|
|
||||||
cmds.push("-p " + (this.blockchainConfig.rpcPort || options.port || 8545));
|
cmds.push("-p " + (this.blockchainConfig.rpcPort || options.port || 8545));
|
||||||
cmds.push("-h " + (this.blockchainConfig.rpcHost || options.host || 'localhost'));
|
cmds.push("-h " + (this.blockchainConfig.rpcHost || options.host || 'localhost'));
|
||||||
cmds.push("-a " + (options.num || 10));
|
cmds.push("-a " + (options.numAccounts || 10));
|
||||||
|
cmds.push("-e " + (options.defaultBalance || 100));
|
||||||
|
cmds.push("-l " + (options.gasLimit || 8000000));
|
||||||
|
|
||||||
shelljs.exec('testrpc ' + cmds.join(' '), {async : true});
|
shelljs.exec('testrpc ' + cmds.join(' '), {async : true});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue