mirror of https://github.com/atom/atom.git
Merge pull request #25442 from claytonrcarter/fix-usage-message
Fix usage message (closes #25441)
This commit is contained in:
commit
17a31e3a37
|
@ -12,14 +12,10 @@ const CSON = require('season');
|
||||||
const yargs = require('yargs');
|
const yargs = require('yargs');
|
||||||
const { app } = require('electron');
|
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)
|
const args = yargs(process.argv)
|
||||||
.alias('v', 'version')
|
// Don't handle --help or --version here; they will be handled later.
|
||||||
.version(version)
|
.help(false)
|
||||||
|
.version(false)
|
||||||
.alias('d', 'dev')
|
.alias('d', 'dev')
|
||||||
.alias('t', 'test')
|
.alias('t', 'test')
|
||||||
.alias('r', 'resource-path').argv;
|
.alias('r', 'resource-path').argv;
|
||||||
|
|
|
@ -57,10 +57,7 @@ module.exports = function parseCommandLine(processArgs) {
|
||||||
.alias('f', 'foreground')
|
.alias('f', 'foreground')
|
||||||
.boolean('f')
|
.boolean('f')
|
||||||
.describe('f', 'Keep the main process in the foreground.');
|
.describe('f', 'Keep the main process in the foreground.');
|
||||||
options
|
options.help('help', 'Print this usage message.').alias('h', 'help');
|
||||||
.alias('h', 'help')
|
|
||||||
.boolean('h')
|
|
||||||
.describe('h', 'Print this usage message.');
|
|
||||||
options
|
options
|
||||||
.alias('l', 'log-file')
|
.alias('l', 'log-file')
|
||||||
.string('l')
|
.string('l')
|
||||||
|
@ -136,7 +133,16 @@ module.exports = function parseCommandLine(processArgs) {
|
||||||
'Enable low-level logging messages from Electron.'
|
'Enable low-level logging messages from Electron.'
|
||||||
);
|
);
|
||||||
options.boolean('uri-handler');
|
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;
|
let args = options.argv;
|
||||||
|
|
||||||
// If --uri-handler is set, then we parse NOTHING else
|
// If --uri-handler is set, then we parse NOTHING else
|
||||||
|
@ -148,11 +154,6 @@ module.exports = function parseCommandLine(processArgs) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.help) {
|
|
||||||
process.stdout.write(options.help());
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const addToLastWindow = args['add'];
|
const addToLastWindow = args['add'];
|
||||||
const safeMode = args['safe'];
|
const safeMode = args['safe'];
|
||||||
const benchmark = args['benchmark'];
|
const benchmark = args['benchmark'];
|
||||||
|
|
|
@ -37,15 +37,18 @@ module.exports = function start(resourcePath, devResourcePath, startTime) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const previousConsoleLog = console.log;
|
|
||||||
console.log = nslog;
|
|
||||||
|
|
||||||
// TodoElectronIssue this should be set to true before Electron 12 - https://github.com/electron/electron/issues/18397
|
// TodoElectronIssue this should be set to true before Electron 12 - https://github.com/electron/electron/issues/18397
|
||||||
app.allowRendererProcessReuse = false;
|
app.allowRendererProcessReuse = false;
|
||||||
|
|
||||||
app.commandLine.appendSwitch('enable-experimental-web-platform-features');
|
app.commandLine.appendSwitch('enable-experimental-web-platform-features');
|
||||||
|
|
||||||
const args = parseCommandLine(process.argv.slice(1));
|
const args = parseCommandLine(process.argv.slice(1));
|
||||||
|
|
||||||
|
// This must happen after parseCommandLine() because yargs uses console.log
|
||||||
|
// to display the usage message.
|
||||||
|
const previousConsoleLog = console.log;
|
||||||
|
console.log = nslog;
|
||||||
|
|
||||||
args.resourcePath = normalizeDriveLetterName(resourcePath);
|
args.resourcePath = normalizeDriveLetterName(resourcePath);
|
||||||
args.devResourcePath = normalizeDriveLetterName(devResourcePath);
|
args.devResourcePath = normalizeDriveLetterName(devResourcePath);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue