add locale option to most cmds
This commit is contained in:
parent
517a3bf234
commit
854fa0deb0
18
lib/cmd.js
18
lib/cmd.js
|
@ -46,7 +46,9 @@ class Cmd {
|
|||
.command('new [name]')
|
||||
.description(__('New Application'))
|
||||
.option('--simple', __('create a barebones project meant only for contract development'))
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.action(function (name, options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
if (name === undefined) {
|
||||
return promptly.prompt(__("Name your app (default is %s):", 'embarkDapp'), {
|
||||
default: "embarkDApp",
|
||||
|
@ -79,8 +81,10 @@ class Cmd {
|
|||
demo() {
|
||||
program
|
||||
.command('demo')
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('create a working dapp with a SimpleStorage contract'))
|
||||
.action(function () {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.generateTemplate('demo', './', 'embark_demo');
|
||||
});
|
||||
}
|
||||
|
@ -90,8 +94,10 @@ class Cmd {
|
|||
.command('build [environment]')
|
||||
.option('--logfile [logfile]', __('filename to output logs (default: none)'))
|
||||
.option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug')
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('deploy and build dapp at ') + 'dist/ (default: development)')
|
||||
.action(function (env, _options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
_options.env = env || 'development';
|
||||
_options.logFile = _options.logfile; // fix casing
|
||||
_options.logLevel = _options.loglevel; // fix casing
|
||||
|
@ -129,8 +135,10 @@ class Cmd {
|
|||
program
|
||||
.command('blockchain [environment]')
|
||||
.option('-c, --client [client]', __('Use a specific ethereum client or simulator (supported: %s)', 'geth, testrpc'))
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('run blockchain server (default: %s)', 'development'))
|
||||
.action(function (env, options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.initConfig(env || 'development', {
|
||||
embarkConfig: 'embark.json',
|
||||
interceptLogs: false
|
||||
|
@ -149,8 +157,10 @@ class Cmd {
|
|||
.option('-a, --accounts [numAccounts]', __('number of accounts (default: %s)', '10'))
|
||||
.option('-e, --defaultBalanceEther [balance]', __('Amount of ether to assign each test account (default: %s)', '100'))
|
||||
.option('-l, --gasLimit [gasLimit]', __('custom gas limit (default: %s)', '8000000'))
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
|
||||
.action(function (env, options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.initConfig(env || 'development', {
|
||||
embarkConfig: 'embark.json',
|
||||
interceptLogs: false
|
||||
|
@ -168,8 +178,10 @@ class Cmd {
|
|||
test() {
|
||||
program
|
||||
.command('test [file]')
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('run tests'))
|
||||
.action(function (file) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.initConfig('development', {
|
||||
embarkConfig: 'embark.json', interceptLogs: false
|
||||
});
|
||||
|
@ -182,8 +194,10 @@ class Cmd {
|
|||
.command('upload <platform> [environment]')
|
||||
.option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none'))
|
||||
.option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug')
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('Upload your dapp to a decentralized storage') + ' (e.g embark upload ipfs).')
|
||||
.action(function (platform, env, _options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
_options.env = env || 'development';
|
||||
_options.logFile = _options.logfile; // fix casing
|
||||
_options.logLevel = _options.loglevel; // fix casing
|
||||
|
@ -197,8 +211,10 @@ class Cmd {
|
|||
.option('--skip-undeployed', __('Graph will not include undeployed contracts'))
|
||||
.option('--skip-functions', __('Graph will not include functions'))
|
||||
.option('--skip-events', __('Graph will not include events'))
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('generates documentation based on the smart contracts configured'))
|
||||
.action(function (env, options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.graph({
|
||||
env: env || 'development',
|
||||
logFile: options.logfile,
|
||||
|
@ -212,8 +228,10 @@ class Cmd {
|
|||
reset() {
|
||||
program
|
||||
.command('reset')
|
||||
.option('--locale [locale]', __('language to use (default: en)'))
|
||||
.description(__('resets embarks state on this dapp including clearing cache'))
|
||||
.action(function () {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
embark.initConfig('development', {
|
||||
embarkConfig: 'embark.json', interceptLogs: false
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue