Run Main
Run js main function.
Features
- Run sync/async function
- Exit after execution
- Log uncaught error
- Prepare intuitive command args
Install
npm install @zhaoyao91/run-main
Usage
const runMain = require("@zhaoyao91/run-main");
async function main(...args) {
// ...
}
runMain(main);
API
runMain(mainFn, options?)
-
mainFn
: async function(...args) -
options.logError?
: function(error), default toconsole.error
-
options.forceExit?
: boolean, default tofalse
License
MIT