Skip to content

Create a way to get a structured representation of a given .NET CLI command #46345

Open
@baronfel

Description

@baronfel

Is your feature request related to a problem? Please describe.

It can be useful for tools that are doing feature-probing of the .NET CLI to provide some structured representation of the CLI Command being invoked.

Describe the solution you'd like

This structured representation should provide access to

  • the names and aliases of the command (if any)
  • the options on the command
  • the arguments on the command
  • the subcommands on this command (recursively)

In this output, hidden items should be shown.

Additional context

The least grammar impacting way to do this would be a Directive, a la dotnet run [structure format=json], but there's space for some kind of global flag that could be used as well (dotnet run --dump-grammar?).

This was first requested in dotnet/aspire#7112 (comment).
NuGet experiences in DevKit also drive themselves based on the CLI capabilities and could make use of this.

Metadata

Metadata

Labels

Feature Requestcli-uxIssues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions