UNPKG

1.24 kBMarkdownView Raw
1# `@diez/cli-core`
2
3This package provides the core functionality of the extensible Diez command line interface.
4
5Diez configurations, which can be specified either in `package.json` using the special `"diez"` key or in a dedicated `.diezrc` file, can extend the command line functionality in various ways, including registering compiler targets and providing entire new commands.
6
7A `CliCommandProvider` can be implemented in a Diez package like this:
8
9```
10// src/commands/command.ts
11import {CliCommandProvider} from '@diez/cli-core';
12
13const provider: CliCommandProvider = {
14 loadAction: () => action,
15 name: 'command',
16 description: 'Command description',
17 options: [
18 {
19 shortName: 'o',
20 longName: 'option',
21 valueName: 'optionValue',
22 description: 'Some option.',
23 },
24 ],
25};
26
27export = provider;
28```
29
30A custom command provider can be registered in `package-name/package.json`:
31
32```
33{
34 "name": "package-name",
35 ...,
36 "diez": {
37 "providers": {
38 "commands": ["./lib/commands/command"]
39 }
40 }
41}
42```
43
44or in `package-name/.diezrc`:
45
46```
47{
48 "providers": {
49 "commands": ["./lib/commands/command"]
50 }
51}
52```
53
54The resulting command can be invoked with: `diez command --option [-o] <optionValue>`.