Add --help to electron app

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-08-09 12:08:56 +01:00
parent e577f30cb5
commit 12f087401b
1 changed files with 17 additions and 1 deletions

View File

@ -23,7 +23,10 @@ limitations under the License.
const checkSquirrelHooks = require('./squirrelhooks'); const checkSquirrelHooks = require('./squirrelhooks');
if (checkSquirrelHooks()) return; if (checkSquirrelHooks()) return;
const argv = require('minimist')(process.argv); const argv = require('minimist')(process.argv, {
alias: {help: "h"},
});
const {app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol} = require('electron'); const {app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol} = require('electron');
const AutoLaunch = require('auto-launch'); const AutoLaunch = require('auto-launch');
const path = require('path'); const path = require('path');
@ -37,6 +40,19 @@ const { migrateFromOldOrigin } = require('./originMigrator');
const windowStateKeeper = require('electron-window-state'); const windowStateKeeper = require('electron-window-state');
const Store = require('electron-store'); const Store = require('electron-store');
if (argv["help"]) {
console.log("Options:");
console.log(" --profile-dir {path}: Path to where to store the profile.");
console.log(" --profile {name}: Name of alternate profile to use, allows for running multiple accounts.");
console.log(" --devtools: Install and use react-devtools and react-perf.");
console.log(" --no-update: Disable automatic updating.");
console.log(" --hidden: Start the application hidden in the system tray.");
console.log(" --help: Displays this help message.");
console.log("And more such as --proxy, see:" +
"https://github.com/electron/electron/blob/master/docs/api/chrome-command-line-switches.md");
app.exit();
}
// boolean flag set whilst we are doing one-time origin migration // boolean flag set whilst we are doing one-time origin migration
// We only serve the origin migration script while we're actually // We only serve the origin migration script while we're actually
// migrating to mitigate any risk of it being used maliciously. // migrating to mitigate any risk of it being used maliciously.