Skip to content

Commit 8d9d4d3

Browse files
committed
update options in help messages
1 parent fc3d9c0 commit 8d9d4d3

File tree

4 files changed

+66
-36
lines changed

4 files changed

+66
-36
lines changed

bin/helpers/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ const cliMessages = {
4949
INFO: "Run your tests on BrowserStack.",
5050
DESC: "Path to BrowserStack config",
5151
CONFIG_DEMAND: "config file is required"
52+
},
53+
COMMON: {
54+
DISABLE_USAGE_REPORTING: "Disable usage reporting"
5255
}
5356
}
5457

bin/helpers/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ exports.sendUsageReport = (bsConfig, args, message, message_type, error_code) =>
6161
}
6262

6363
exports.setUsageReportingFlag = (bsConfig, disableUsageReporting) => {
64-
if (disableUsageReporting === undefined && bsConfig && bsConfig['disable-usage-reporting'] != undefined) {
65-
process.env.DISABLE_USAGE_REPORTING = bsConfig['disable-usage-reporting'];
64+
if (disableUsageReporting === undefined && bsConfig && bsConfig['disable_usage_reporting'] != undefined) {
65+
process.env.DISABLE_USAGE_REPORTING = bsConfig['disable_usage_reporting'];
6666
} else {
6767
process.env.DISABLE_USAGE_REPORTING = disableUsageReporting;
6868
}

bin/runner.js

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ var argv = yargs
2222
.demand(1, Constants.cliMessages.VERSION.DEMAND)
2323
.command('init', Constants.cliMessages.INIT.INFO, function(yargs) {
2424
argv = yargs
25-
.usage('usage: $0 init [options]')
26-
.options('p', {
27-
alias: 'path',
28-
default: false,
29-
description: Constants.cliMessages.INIT.DESC,
30-
type: 'string'
25+
.usage("usage: $0 init [options]")
26+
.options({
27+
'p': {
28+
alias: "path",
29+
default: false,
30+
description: Constants.cliMessages.INIT.DESC,
31+
type: "string",
32+
},
33+
'disable-usage-reporting': {
34+
default: undefined,
35+
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
36+
type: "boolean"
37+
},
3138
})
32-
.help('help')
33-
.wrap(null)
34-
.argv
39+
.help("help")
40+
.wrap(null).argv;
3541

3642
if (checkCommands(yargs, argv, 1)) {
3743
return require('./commands/init')(argv);
@@ -41,14 +47,21 @@ var argv = yargs
4147
argv = yargs
4248
.usage('usage: $0 <buildId>')
4349
.demand(1, Constants.cliMessages.BUILD.DEMAND)
44-
.options('cf', {
45-
alias: 'config-file',
46-
describe: Constants.cliMessages.BUILD.DESC,
47-
default: '/browserstack.json',
48-
type: 'string',
49-
nargs: 1,
50-
demand: true,
51-
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
50+
.options({
51+
'cf': {
52+
alias: 'config-file',
53+
describe: Constants.cliMessages.BUILD.DESC,
54+
default: '/browserstack.json',
55+
type: 'string',
56+
nargs: 1,
57+
demand: true,
58+
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
59+
},
60+
'disable-usage-reporting': {
61+
default: undefined,
62+
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
63+
type: "boolean"
64+
},
5265
})
5366
.help('help')
5467
.wrap(null)
@@ -62,14 +75,21 @@ var argv = yargs
6275
argv = yargs
6376
.usage('usage: $0 <buildId>')
6477
.demand(1, Constants.cliMessages.BUILD.DEMAND)
65-
.options('cf', {
66-
alias: 'config-file',
67-
describe: Constants.cliMessages.BUILD.DESC,
68-
default: '/browserstack.json',
69-
type: 'string',
70-
nargs: 1,
71-
demand: true,
72-
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
78+
.options({
79+
'cf': {
80+
alias: 'config-file',
81+
describe: Constants.cliMessages.BUILD.DESC,
82+
default: '/browserstack.json',
83+
type: 'string',
84+
nargs: 1,
85+
demand: true,
86+
demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
87+
},
88+
'disable-usage-reporting': {
89+
default: undefined,
90+
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
91+
type: "boolean"
92+
},
7393
})
7494
.help('help')
7595
.wrap(null)
@@ -82,14 +102,21 @@ var argv = yargs
82102
.command('run', Constants.cliMessages.RUN.INFO, function(yargs) {
83103
argv = yargs
84104
.usage('usage: $0 build')
85-
.options('cf', {
86-
alias: 'config-file',
87-
describe: Constants.cliMessages.RUN.DESC,
88-
default: '/browserstack.json',
89-
type: 'string',
90-
nargs: 1,
91-
demand: true,
92-
demand: Constants.cliMessages.RUN.CONFIG_DEMAND
105+
.options({
106+
'cf': {
107+
alias: 'config-file',
108+
describe: Constants.cliMessages.RUN.DESC,
109+
default: '/browserstack.json',
110+
type: 'string',
111+
nargs: 1,
112+
demand: true,
113+
demand: Constants.cliMessages.RUN.CONFIG_DEMAND
114+
},
115+
'disable-usage-reporting': {
116+
default: undefined,
117+
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
118+
type: "boolean"
119+
},
93120
})
94121
.help('help')
95122
.wrap(null)

bin/templates/configTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function () {
2020
"local": false,
2121
"localIdentifier": null
2222
},
23-
"disable-usage-reporting": false
23+
"disable_usage_reporting": false
2424
}
2525
var EOL = require('os').EOL
2626
var file = [

0 commit comments

Comments
 (0)