1 | #!/usr/bin/env node
|
2 |
|
3 | var program = require('commander');
|
4 | var meta = require('../package.json');
|
5 | var spawn = require('child_process').spawn;
|
6 |
|
7 | program
|
8 | .version(meta.version)
|
9 | .command('build [path]', 'build document from the directory')
|
10 | .command('install [path]', 'install theme or plugin')
|
11 | .command('preview [path]', 'build and preview the document from directory')
|
12 | .parse(process.argv);
|
13 |
|
14 | if (!/(build|install|preview|help)/.test(process.argv[2])) {
|
15 | spawn(
|
16 | process.argv[1],
|
17 | ['build'].concat(process.argv.slice(2)),
|
18 | {
|
19 | 'stdio': 'inherit',
|
20 | 'env': process.env
|
21 | }
|
22 | );
|
23 | }
|