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.
This commit is contained in:
Sam Marder 2017-01-21 13:54:32 -05:00 committed by Matheus Fernandes
parent a0a8484158
commit edff890f5f

View file

@ -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