Skip to content

Commit b085e76

Browse files
committed
docs(apps/docs/src/pages/en/api.md): add explanation about CommandRunner and registerWithSubCommands
1 parent 4a3dd2d commit b085e76

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/docs/src/pages/en/api.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,25 @@ Options that can be passed to the `run` or `runWithoutClosing` method to modify
228228
| usePlugins | `boolean` | false | The choice of if the built CLI should look for a config file and plugins or not. |
229229
| cliName | `string` | false | The name of the CLI and the prefix for the config file to be looked for. Defaults to `"nest-commander"`. |
230230

231+
### CommandRunner
232+
233+
The `CommandRunner` is abstract class to define your command. You define the command in the class inherits it.
234+
235+
#### registerWithSubCommands
236+
237+
A static method returns list of root command class which calls this api and all sub command classes set as metadata of `@Command` and `@SubCommand` decorators in the scope of module tree the root command class traverses.
238+
239+
```typescript title="src/app.module.ts"
240+
@Module({
241+
providers: [...RunCommand.regsiterWithSubCommands()]
242+
})
243+
export class AppModule {}
244+
```
245+
246+
| Parameter | Type | Required | Description |
247+
| --- | --- | --- | --- |
248+
| meta | string | false | `@Command` or `@SubCommand` id is explicitly specified for extracting metadata, It is used internal this library and you shouldn't need to specify it normally. |
249+
231250
## nest-commander-testing
232251

233252
### CommandTestFactory

0 commit comments

Comments
 (0)