Skip to content

Commit

Permalink
update options in help messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nagpalkaran95 committed May 12, 2020
1 parent fc3d9c0 commit 8d9d4d3
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 36 deletions.
3 changes: 3 additions & 0 deletions bin/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const cliMessages = {
INFO: "Run your tests on BrowserStack.",
DESC: "Path to BrowserStack config",
CONFIG_DEMAND: "config file is required"
},
COMMON: {
DISABLE_USAGE_REPORTING: "Disable usage reporting"
}
}

Expand Down
4 changes: 2 additions & 2 deletions bin/helpers/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ exports.sendUsageReport = (bsConfig, args, message, message_type, error_code) =>
}

exports.setUsageReportingFlag = (bsConfig, disableUsageReporting) => {
if (disableUsageReporting === undefined && bsConfig && bsConfig['disable-usage-reporting'] != undefined) {
process.env.DISABLE_USAGE_REPORTING = bsConfig['disable-usage-reporting'];
if (disableUsageReporting === undefined && bsConfig && bsConfig['disable_usage_reporting'] != undefined) {
process.env.DISABLE_USAGE_REPORTING = bsConfig['disable_usage_reporting'];
} else {
process.env.DISABLE_USAGE_REPORTING = disableUsageReporting;
}
Expand Down
93 changes: 60 additions & 33 deletions bin/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@ var argv = yargs
.demand(1, Constants.cliMessages.VERSION.DEMAND)
.command('init', Constants.cliMessages.INIT.INFO, function(yargs) {
argv = yargs
.usage('usage: $0 init [options]')
.options('p', {
alias: 'path',
default: false,
description: Constants.cliMessages.INIT.DESC,
type: 'string'
.usage("usage: $0 init [options]")
.options({
'p': {
alias: "path",
default: false,
description: Constants.cliMessages.INIT.DESC,
type: "string",
},
'disable-usage-reporting': {
default: undefined,
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
type: "boolean"
},
})
.help('help')
.wrap(null)
.argv
.help("help")
.wrap(null).argv;

if (checkCommands(yargs, argv, 1)) {
return require('./commands/init')(argv);
Expand All @@ -41,14 +47,21 @@ var argv = yargs
argv = yargs
.usage('usage: $0 <buildId>')
.demand(1, Constants.cliMessages.BUILD.DEMAND)
.options('cf', {
alias: 'config-file',
describe: Constants.cliMessages.BUILD.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
.options({
'cf': {
alias: 'config-file',
describe: Constants.cliMessages.BUILD.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
},
'disable-usage-reporting': {
default: undefined,
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
type: "boolean"
},
})
.help('help')
.wrap(null)
Expand All @@ -62,14 +75,21 @@ var argv = yargs
argv = yargs
.usage('usage: $0 <buildId>')
.demand(1, Constants.cliMessages.BUILD.DEMAND)
.options('cf', {
alias: 'config-file',
describe: Constants.cliMessages.BUILD.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
.options({
'cf': {
alias: 'config-file',
describe: Constants.cliMessages.BUILD.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
},
'disable-usage-reporting': {
default: undefined,
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
type: "boolean"
},
})
.help('help')
.wrap(null)
Expand All @@ -82,14 +102,21 @@ var argv = yargs
.command('run', Constants.cliMessages.RUN.INFO, function(yargs) {
argv = yargs
.usage('usage: $0 build')
.options('cf', {
alias: 'config-file',
describe: Constants.cliMessages.RUN.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.RUN.CONFIG_DEMAND
.options({
'cf': {
alias: 'config-file',
describe: Constants.cliMessages.RUN.DESC,
default: '/browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.RUN.CONFIG_DEMAND
},
'disable-usage-reporting': {
default: undefined,
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
type: "boolean"
},
})
.help('help')
.wrap(null)
Expand Down
2 changes: 1 addition & 1 deletion bin/templates/configTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function () {
"local": false,
"localIdentifier": null
},
"disable-usage-reporting": false
"disable_usage_reporting": false
}
var EOL = require('os').EOL
var file = [
Expand Down

0 comments on commit 8d9d4d3

Please sign in to comment.