-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import synopt from "./dist/synopt.js"; | ||
|
||
// Declare options | ||
synopt | ||
.name("mkwebmanifest") // optional, for usage banner | ||
.summary("Generate icons and web manifest for web applications") | ||
.option("-i", "--icon ICON", "source icon file") | ||
.option("-n", "--name", "name of the web application", { repeat: true }) | ||
.option("--config FILE", "configuration file") | ||
.option("--outdir <directory>", "directory path for generated files") | ||
.option("--verbose", "more output", { boolean: true }) | ||
.option("-h", "--help", "print help", { boolean: true }); | ||
|
||
// Slice off node executable and script from argument vector | ||
const argv = process.argv.slice(2); | ||
|
||
// And parse arguments. No exceptions to catch, instead check result object | ||
const { ok, error, options } = synopt.parse(argv); | ||
|
||
if (ok) { | ||
// Happy case | ||
main(options); | ||
} else { | ||
// Handle errors: missing value, or unknown options/typos, etc. | ||
console.log(error); | ||
console.log(synopt.usage()); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters