Skip to content

Commit 19b28ed

Browse files
fix: Include -v/--version in the main usage message
1 parent 98ab593 commit 19b28ed

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/main-process/main.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ const CSON = require('season');
1212
const yargs = require('yargs');
1313
const { app } = require('electron');
1414

15-
const version = `Atom : ${app.getVersion()}
16-
Electron: ${process.versions.electron}
17-
Chrome : ${process.versions.chrome}
18-
Node : ${process.versions.node}`;
19-
2015
const args = yargs(process.argv)
21-
.alias('v', 'version')
22-
.version(version)
16+
// Don't handle --help or --version here; they will be handled later.
2317
.help(false)
18+
.version(false)
2419
.alias('d', 'dev')
2520
.alias('t', 'test')
2621
.alias('r', 'resource-path').argv;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,16 @@ module.exports = function parseCommandLine(processArgs) {
133133
'Enable low-level logging messages from Electron.'
134134
);
135135
options.boolean('uri-handler');
136+
options
137+
.version(
138+
dedent`Atom : ${version}
139+
Electron: ${process.versions.electron}
140+
Chrome : ${process.versions.chrome}
141+
Node : ${process.versions.node}`
142+
)
143+
.alias('v', 'version');
136144

145+
// NB: if --help or --version are given, this also displays the relevant message and exits
137146
let args = options.argv;
138147

139148
// If --uri-handler is set, then we parse NOTHING else

0 commit comments

Comments
 (0)