-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.ts
40 lines (32 loc) · 1.24 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Command } from 'commander';
import dotenv from 'dotenv';
import { ConvertCommand } from './convert.command';
import { DevCommand } from './dev.command';
import { DiffCommand } from './diff.command';
import { DumpCommand } from './dump.command';
import { LintCommand } from './lint.command';
import { PingCommand } from './ping.command';
import { SyncCommand } from './sync.command';
import { configurePluralize } from './utils';
export const setupCommands = (): Command => {
const program = new Command('adc');
program
.description('API Declarative CLI (ADC) is a utility to manage API7 Enterprise and Apache APISIX declaratively.\n\nLearn more at: https://docs.api7.ai/enterprise/reference/adc')
.configureHelp({ showGlobalOptions: true })
.passThroughOptions()
.version('0.15.0', '-v, --version', 'display ADC version');
program
.addCommand(PingCommand)
.addCommand(DumpCommand)
.addCommand(DiffCommand)
.addCommand(SyncCommand)
.addCommand(ConvertCommand)
.addCommand(LintCommand);
//.addCommand(ValidateCommand)
if (process.env.NODE_ENV === 'development') program.addCommand(DevCommand);
// initialize dotenv
dotenv.config();
// initialize pluralize
configurePluralize();
return program;
};