Skip to content

Commit

Permalink
chore: fix links these may be broken changing rules from docusaurus t…
Browse files Browse the repository at this point in the history
…o astro
  • Loading branch information
tkow committed Dec 25, 2022
1 parent d3ba9e2 commit 4a3dd2d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/docs/src/pages/en/features/commander.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class TaskRunner extends CommandRunner {

You'll notice for the `arguments` we use angle brackets around the argument name. This specifies that the argument is required for the command, and commander will throw an error if it is not supplied. If, however, we wanted to make the argument optional, we could wrap it in square brackets instead like `[task]`.

Now, to run this command, we'll need to set up the [CommandFactory](./factory.md) and make use of one of the execution methods as described later in the docs. For now, we'll just assume this application is installed globally under the `crun` name. Running the above command would then look like
Now, to run this command, we'll need to set up the [CommandFactory](./factory) and make use of one of the execution methods as described later in the docs. For now, we'll just assume this application is installed globally under the `crun` name. Running the above command would then look like

```shell
crun my-exec 'echo Hello World!'
Expand Down Expand Up @@ -97,7 +97,7 @@ Options also allow for variadic inputs but you will need to provide an option pa

### Setting Choices for your Options

Commander also allows us to set up pre-defined choices for options. To do so we have two options: setting the `choices` array directly as a part of the `@Option()` decorator, or using the `@OptionChoiceFor()` decorator and a class method, similar to the [InquirerService](./inquirer.md). With using the `@OptionChoiceFor()` decorator, we are also able to make use of class providers that are injected into the command via Nest's DI which allows devs to read for the choices from a file or database if that happens to be necessary.
Commander also allows us to set up pre-defined choices for options. To do so we have two options: setting the `choices` array directly as a part of the `@Option()` decorator, or using the `@OptionChoiceFor()` decorator and a class method, similar to the [InquirerService](./inquirer). With using the `@OptionChoiceFor()` decorator, we are also able to make use of class providers that are injected into the command via Nest's DI which allows devs to read for the choices from a file or database if that happens to be necessary.

```typescript
import { Option, OptionChoiceFor } from 'nest-commander';
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/pages/en/features/factory.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Okay, so you've got this fancy command set up, it takes in some user input, and

## Registering Your Commands and Questions

You may have noticed in the [Inquirer](./inquirer.md) section a quick mention of adding the question set class to the `providers`. In fact, both command classes and question set classes are nothing more than specialized providers! Due to this, we can simply add these classes to a module's metadata and make sure that module is in the root module the `CommandFactory` uses.
You may have noticed in the [Inquirer](./inquirer) section a quick mention of adding the question set class to the `providers`. In fact, both command classes and question set classes are nothing more than specialized providers! Due to this, we can simply add these classes to a module's metadata and make sure that module is in the root module the `CommandFactory` uses.

```typescript title="src/app.module.ts"
@Module({
Expand Down Expand Up @@ -40,4 +40,4 @@ By default, there is no error handler for commander provided by `nest-commander`

The `CommandFactory` also allows you to set up an infinite runner, so that you can set up file watchers or similar. All you need to do is instead of using `run` use `runWithoutClosing`. All other options are the same.

For more information on the `CommandFactory`, please refer to the [API docs](../api.md#commandfactory).
For more information on the `CommandFactory`, please refer to the [API docs](../api#commandfactory).
2 changes: 1 addition & 1 deletion apps/docs/src/pages/en/features/inquirer.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ If you need to ask a question dynamically, not something that can be set up with

:::

Visit the [api docs](../api.md) to learn more about the `InquirerService`'s `ask` command and extra decorators.
Visit the [api docs](../api) to learn more about the `InquirerService`'s `ask` command and extra decorators.

0 comments on commit 4a3dd2d

Please sign in to comment.