Skip to content

Commit 98ab593

Browse files
fix: Prevent the first call to yargs from responding to --help
The second call to yargs should be responsible for printing the main usage message. This also fixes the `--help` description w/i the usage message, which was only using the yargs default description.
1 parent 0ae715d commit 98ab593

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/main-process/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Node : ${process.versions.node}`;
2020
const args = yargs(process.argv)
2121
.alias('v', 'version')
2222
.version(version)
23+
.help(false)
2324
.alias('d', 'dev')
2425
.alias('t', 'test')
2526
.alias('r', 'resource-path').argv;

src/main-process/parse-command-line.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ module.exports = function parseCommandLine(processArgs) {
5757
.alias('f', 'foreground')
5858
.boolean('f')
5959
.describe('f', 'Keep the main process in the foreground.');
60-
options
61-
.alias('h', 'help')
62-
.boolean('h')
63-
.describe('h', 'Print this usage message.');
60+
options.help('help', 'Print this usage message.').alias('h', 'help');
6461
options
6562
.alias('l', 'log-file')
6663
.string('l')
@@ -148,11 +145,6 @@ module.exports = function parseCommandLine(processArgs) {
148145
};
149146
}
150147

151-
if (args.help) {
152-
process.stdout.write(options.help());
153-
process.exit(0);
154-
}
155-
156148
const addToLastWindow = args['add'];
157149
const safeMode = args['safe'];
158150
const benchmark = args['benchmark'];

0 commit comments

Comments
 (0)