Skip to content

Commit 92bd87c

Browse files
committed
Add --help
1 parent e7caeee commit 92bd87c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
const electron = require('electron');
22
const path = require('path');
33
const minimist = require('minimist');
4+
const usage = require('./usage');
45

56
const argv = minimist(process.argv.slice(2), {
67
boolean: true
78
});
89

10+
if (argv.help) {
11+
console.error(usage);
12+
process.exit(0);
13+
}
14+
915
let argument = argv._[0];
1016
if (!argument) {
1117
console.error('Error: No filename specified!');

usage.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = `Usage: qmlweb-viewer [options] <filename>
2+
3+
Options
4+
--debug .......................... Open Dev Tools window
5+
--help ........................... Display help and exit
6+
`;

0 commit comments

Comments
 (0)