1 | #!/usr/bin/env node
|
2 |
|
3 | const program = require('commander'),
|
4 | updateNotifier = require('update-notifier'),
|
5 | pkg = require('./package.json'),
|
6 | logger = require('./lib/logger'),
|
7 | version = pkg.version;
|
8 |
|
9 | updateNotifier({
|
10 | pkg: pkg
|
11 | }).notify({
|
12 | defer: true,
|
13 | isGlobal: true
|
14 | });
|
15 |
|
16 | program
|
17 | .version(version)
|
18 | .command('audit', 'check your code for deprecations, recommendations, errors')
|
19 | .command('data', 'export, import or clean data on instance')
|
20 | .command('deploy [environment]', 'deploy code to environment').alias('d')
|
21 | .command('env', 'manage environments')
|
22 | .command('gui', 'gui for content editor, graphql')
|
23 | .command('init', 'initialize required directory structure')
|
24 | .command('logs [environment]', 'attach to environment log streams')
|
25 | .command('migrations', 'generate or run a migration')
|
26 | .command('modules', 'manage modules')
|
27 | .command('sync [environment]', 'update environment on file change')
|
28 | .parse(process.argv);
|
29 |
|
30 | const commandList = Object.keys(program._execs);
|
31 | if (!commandList.includes(program.args[0])) {
|
32 | logger.Error(`unknown command: ${program.args[0]}`, { exit: false });
|
33 | program.help();
|
34 | process.exit(1);
|
35 | }
|
36 |
|
37 | if (!program.args.length) program.help();
|