From edff890f5fcd4e975c42169153fe8c2be9039fd7 Mon Sep 17 00:00:00 2001 From: Sam Marder Date: Sat, 21 Jan 2017 13:54:32 -0500 Subject: [PATCH] Add `--help` and `--version` command line arguments (#1278) * Added --help command line argument. Also looks for -v and --version. * Fixing linting issues. * Deleted incorrect comment that used to make sense. * Cleaner arguments checking. * Used newer JS syntax. --- app/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/index.js b/app/index.js index 596328a6..2e53f3d1 100644 --- a/app/index.js +++ b/app/index.js @@ -1,3 +1,14 @@ +// Print diagnostic information for a few arguments instead of running Hyper. +if (['--help', '-v', '--version'].includes(process.argv[1])) { + const {version} = require('./package'); + const configLocation = process.platform === 'win32' ? process.env.userprofile + '\\.hyper.js' : '~/.hyper.js'; + console.log(`Hyper version ${version}`); + console.log('Hyper does not accept any command line arguments. Please modify the config file instead.'); + console.log(`Hyper configuration file located at: ${configLocation}`); + // eslint-disable-next-line unicorn/no-process-exit + process.exit(); +} + // handle startup squirrel events if (process.platform === 'win32') { // eslint-disable-next-line import/order