UNPKG

1.69 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3/* eslint-disable quotes */
4
5'use strict';
6
7const program = require('commander');
8const debug = require('debug');
9
10program
11 .version(require('../package.json').version, '--version')
12 .description(`The fun command line provides a complete set of commands to define, develop,
13test serverless applications locally, and deploy them to the Alibaba Cloud.`)
14 .option('-v, --verbose', 'verbose output', (_, total) => total + 1, 0)
15 // See git-style sub-commands https://github.com/tj/commander.js/#git-style-sub-commands.
16 // See source code: https://github.com/tj/commander.js/blob/master/index.js#L525-L570.
17
18 // The commander will try to search the executables in the directory of the entry script
19 // (like ./examples/pm) with the name program-command.
20 .command('config', 'Configure the fun')
21 .command('init', 'Initialize a new fun project')
22 .command('install', 'Install dependencies which are described in fun.yml')
23 .command('build', 'Build the dependencies')
24 .command('local', 'Run your serverless application locally')
25 .command('edge', 'Run your serverless application at edge')
26 .command('validate', 'Validate a fun template')
27 .command('deploy', 'Deploy a fun application')
28 .command('nas', 'Operate NAS file system')
29 .command("package", 'Package a Function Compute application')
30 .command('invoke', 'Remote invoke function');
31// set default verbose value for subcommand.
32process.env.FUN_VERBOSE = 0;
33
34program.on('option:verbose', () => {
35 if (program.verbose === 4) {
36 debug.enable('*');
37 }
38 process.env.FUN_VERBOSE = program.verbose;
39});
40
41require('../lib/utils/command').registerCommandChecker(program);
42
43program.parse(process.argv);
\No newline at end of file