fix: Include `-v`/`--version` in the main usage message

This commit is contained in:
Clayton Carter 2022-05-04 22:26:06 -04:00
parent 98ab593f46
commit 19b28ed492
2 changed files with 11 additions and 7 deletions

View File

@ -12,15 +12,10 @@ const CSON = require('season');
const yargs = require('yargs');
const { app } = require('electron');
const version = `Atom : ${app.getVersion()}
Electron: ${process.versions.electron}
Chrome : ${process.versions.chrome}
Node : ${process.versions.node}`;
const args = yargs(process.argv)
.alias('v', 'version')
.version(version)
// Don't handle --help or --version here; they will be handled later.
.help(false)
.version(false)
.alias('d', 'dev')
.alias('t', 'test')
.alias('r', 'resource-path').argv;

View File

@ -133,7 +133,16 @@ module.exports = function parseCommandLine(processArgs) {
'Enable low-level logging messages from Electron.'
);
options.boolean('uri-handler');
options
.version(
dedent`Atom : ${version}
Electron: ${process.versions.electron}
Chrome : ${process.versions.chrome}
Node : ${process.versions.node}`
)
.alias('v', 'version');
// NB: if --help or --version are given, this also displays the relevant message and exits
let args = options.argv;
// If --uri-handler is set, then we parse NOTHING else