diff --git a/README.md b/README.md index c94d4a1..99350e9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ environment. To deploy the Whiteflag WHL utility, make sure the following prerequisite software is installed: -* Node.js w/ NPM +* [Node.js](https://nodejs.org/en/about/) including [NPM](https://www.npmjs.com/get-npm) ### Deployment @@ -58,7 +58,7 @@ wfwhl [-s ...] [-w |-f ] The main options are the following: * `-s`, `--sites` : Specify the world heritage site(s) to be processed by \ number; multiple sites may be specified. If no sites are specified, all sites are processed. -* `-w`, `--web` : The source \ of the WHL in XML on the web. If not specified the default is `https://whc.unesco.org/en/list/xml/`. Cannot be used with `-f`. +* `-w`, `--web` : The source \ of the WHL in XML on the web. If not specified the default is `https://whc.unesco.org/en/list/xml/`. Cannot be used with `-f`. * `-f`, `--file` : The source \ containing the WHL in XML. Cannot be used with `-w`. * `-t`, `--transmit`** : Transmit the Whiteflag message(s) on the blockchain. Requires `-i`, `-b` and `-a` to be specified. * `-i`, `--interface`** : The Whiteflag API REST interface \ to post the message(s) to be sent. diff --git a/index.js b/main.js similarity index 89% rename from index.js rename to main.js index 25f63d7..0cebfbc 100755 --- a/index.js +++ b/main.js @@ -13,19 +13,19 @@ const whiteflag = require('./lib/whiteflag'); /* * Gracefully crash if an uncaught exception occurs and - * ensure proper shutdonwn when process is stopped + * ensure proper shutdown when process is stopped */ process.on('uncaughtException', uncaughtExceptionCb); process.on('SIGINT', interruptCb); process.on('SIGTERM', interruptCb); -// MAIN // +// EXECUTE MAIN PROCESS FUNCTION // main(function mainCb(err, exitcode = 0) { - if (err) errorHandler(err, exitcode); - process.exit(exitcode); + if (err) return errorHandler(err, exitcode); + return process.exit(exitcode); }); -// PRIVATE FUNCTIONS // +// MAIN FUNCTIONS // /** * Main process function * @function main @@ -49,6 +49,7 @@ function main(callback) { }); } +// CALLBACK AND HANDLER FUNCTIONS // /** * Function to handle errors * @function errorHandler diff --git a/package.json b/package.json index 75a6daa..7cd8bb0 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,13 @@ "test": "./test", "doc": "./doc" }, - "main": "index.js", + "main": "main.js", "bin": { - "wfwhl": "./index.js" + "whiteflag-whl": "./main.js", + "wfwhl": "./main.js" }, "scripts": { - "start": "node whiteflag.js", + "start": "node main.js", "test": "mocha --recursive", "doc:src": "jsdoc -c .jsdoc.json", "count": "cloc --exclude-dir=node_modules,.vscode --exclude-list-file=.clocignore --by-file lib",