diff --git a/src/frontend/src/content/docs/reference/cli/commands/aspire-resource.mdx b/src/frontend/src/content/docs/reference/cli/commands/aspire-resource.mdx index 0defa4115..ed84504d9 100644 --- a/src/frontend/src/content/docs/reference/cli/commands/aspire-resource.mdx +++ b/src/frontend/src/content/docs/reference/cli/commands/aspire-resource.mdx @@ -30,6 +30,27 @@ selected resource at runtime. This is why the CLI reference documents `aspire resource start`. +### Discovering available resource commands + +Running `aspire resource --help` with a specific resource name queries the running AppHost and appends an **Available resource commands** section to the help output. This lets you discover what commands a resource supports without opening the dashboard. + +```text title="Example output" +Available resource commands: + restart Restart the resource. + start Start the resource. + stop Stop the resource. +``` + +If no single in-scope AppHost can be determined without an explicit `--apphost`, the resource-scoped help is shown without the commands section rather than prompting for AppHost selection. + +To pass `--help` as an argument to the resource command itself (rather than as a CLI help flag), separate it with `--`: + +```bash title="Aspire CLI" +aspire resource myresource mycommand -- --help +``` + +### AppHost selection + When executed without the `--apphost` option, the command: @@ -59,6 +80,10 @@ The following options are available: - +- **`--include-hidden`** + + Includes resource commands that are marked as hidden. By default, hidden commands are not shown in help output or executed. Use this option to expose and run commands that are intentionally hidden from the default command listing. + - - @@ -83,10 +108,34 @@ The following options are available: aspire resource worker stop ``` -- Target a specific AppHost project: +- Target a specific AppHost file: ```bash title="Aspire CLI" - aspire resource api restart --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj' + # C# AppHost + aspire resource api restart --apphost './apphost.cs' + + # TypeScript AppHost + aspire resource api restart --apphost './apphost.ts' + ``` + +- List available commands for a specific resource: + + ```bash title="Aspire CLI" + # C# AppHost + aspire resource myapi --help --apphost './apphost.cs' + + # TypeScript AppHost + aspire resource myapi --help --apphost './apphost.ts' + ``` + +- Include hidden commands when listing available commands: + + ```bash title="Aspire CLI" + # C# AppHost + aspire resource myapi --help --include-hidden --apphost './apphost.cs' + + # TypeScript AppHost + aspire resource myapi --help --include-hidden --apphost './apphost.ts' ``` ## See also