#! /usr/bin/env node import * as docopt from 'docopt'; import { basename, isAbsolute, join } from 'path'; import { Path } from '@quenk/noni/lib/io/file'; import { Arguments, exec, args2Opts } from './cli'; const BIN = basename(__filename); const opts = args2Opts(docopt.docopt(` Usage: ${BIN} [options] [--no-recurse] [--no-start] [--ignore=PATH...] [--root-dir=PATH] ${BIN} [options] [--no-recurse] [--no-start] [--ignore=PATH...] --main PATH Options: -h --help Show this screen. --no-recurse Disable recursive module generation. --no-start Disable writing a start file at the root level. --ignore PATH Ignore paths that match this expression. --main PATH Path to the class that will be used as the app. Must be in the format #. --root-dir PATH The path to treat as the root of the project. Defaults to the current working directory. --version Show version. `, { version: require('../package.json').version })); const expand = (cwd: Path, path: Path) => isAbsolute(path) ? path : join(cwd, path); const main = () => { exec(expand(process.cwd(), opts.module), opts) .fork(e => { console.error(`Error occured: ${e.message}`); process.exit(1); }); } main();