UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

45 lines (38 loc) 1.21 kB
/** * @author Toru Nagashima * @copyright 2016 Toru Nagashima. All rights reserved. * See LICENSE file in root directory for full license. */ "use strict" //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ /*eslint-disable no-process-exit */ module.exports = function bootstrap(name) { const argv = process.argv.slice(2) switch (argv[0]) { case undefined: case "-h": case "--help": return require(`../${name}/help`)(process.stdout) case "-v": case "--version": return require("./version")(process.stdout) default: return require(`../${name}/main`)( argv, process.stdout, process.stderr ).then( () => { // I'm not sure why, but maybe the process never exits // on Git Bash (MINGW64) process.exit(0) }, () => { process.exit(1) } ) } } /*eslint-enable */