|
6 | 6 | 2. Inside the project folder run 'npm run build' |
7 | 7 | 3. Inside the packages folder(https://github.com/microsoft/botframework-cli/tree/master/packages) run 'npx oclif plugin <plugin-name>' |
8 | 8 | 4. Follow the wizard and set the prompts: |
9 | | - |
| 9 | + |
10 | 10 | ? npm package: @microsoft/bf-<plugin-name> |
11 | 11 | ? description: <Plugin brief description> |
12 | 12 | ? author: Microsoft |
|
19 | 19 | ? Use tslint (linter for TypeScript): Y |
20 | 20 | ? Use mocha (testing framework): Y |
21 | 21 | ? Add CI service config (Press <space> to select, <a> to toggle all, <i> to invert selection): select any |
22 | | - |
| 22 | + |
23 | 23 | 4. Go to the folder created by the previous command and add @microsoft/bf-cli-command as a dependency in your package.json file |
24 | | - |
| 24 | + |
25 | 25 | "dependencies": { |
26 | 26 | ..., |
27 | 27 | "@microsoft/bf-cli-command": "1.0.0", |
28 | 28 | ... |
29 | 29 | } |
30 | | - |
| 30 | + |
31 | 31 | 5. At the root level(https://github.com/microsoft/botframework-cli) run 'npm run build' to bootstrap the packages |
32 | 32 |
|
33 | 33 | ## Steps to create a new command |
34 | 34 | 1. Inside the plugin folder run 'npx oclif command <command-name>'. |
35 | 35 | a. To add a subcommand use a colon separated format as follows: |
36 | 36 | <command-name:subcommand-name> |
37 | 37 | 2. Replace the import 'import {Command, flags} from '@oclif/command' line inside the newly created command with '@microsoft/bf-cli-command' |
38 | | - |
| 38 | + |
39 | 39 | - import {Command, flags} from '@oclif/command' |
40 | 40 | + import {Command, flags} from '@microsoft/bf-cli-command' |
41 | | - |
| 41 | + |
42 | 42 | 3. Add the typing to the flags property like this if needed: |
43 | | - |
| 43 | + |
44 | 44 | static flags: flags.Input<any> = { |
45 | 45 | help: flags.help({description: 'Display help'}), |
46 | 46 | } |
47 | | - |
| 47 | + |
48 | 48 | 4. Implement the run method |
49 | 49 |
|
50 | 50 | ## General Guidelines |
@@ -89,7 +89,7 @@ Use the following verbs for standard commands |
89 | 89 | * Commands and options are case SenSiTive, specified in lower case. *bf cmd:subcmd*. |
90 | 90 | * Multi word options are lowcase, nohyphen, multiwords. Multi word commands are forbidden. |
91 | 91 | * Prefer flags to args |
92 | | -* Commands shall follow the *bf \[noun\]\[verb\]\[noun\]* form for example *bf qnamaker:create:kb*. |
| 92 | +* Commands shall follow the *bf \[noun\]\[noun\]\[verb\]* form for example *bf qnamaker:create:kb*. |
93 | 93 | * FLags with specific units: |
94 | 94 | * In general, DO NOT put units in Flag names. ALWAYS put the expected units in the help text. Example: --durationinminutes should simply be --duration. This prevents the need to add more arguments later if more units are supported. |
95 | 95 | * Consider allowing a syntax that will let the user specify units. For example, even if the service requires a value in minutes, consider accepting 1h or 60m. It is fine to assume a default (i.e. 60 = 60 minutes). |
|
0 commit comments