Skip to content

Add CLI Schema Option for System.CommandLine #3

Description

@Flash0ver

Summary

Add System.CommandLine Option for .NET CLI Schema via --cli-schema.

Remarks

The .NET CLI added CLI introspection with --cli-schema in the .NET 10 SDK.

Features

  • Add a public API that adds an Option<bool> to System.CommandLine applications
    • Option<bool> should be recursive, to allow to JSONify the CLI command tree for the invoked command or subcommand
    • Option<bool> should be hidden, to not show in the help output
  • Might accept optional JSON-Serializer options
  • If there is a difference in the format of the output between .NET 10 and the upcoming .NET 11
    • then add a (required/optional) parameter as an enum to select the version
  • Should be Trim-friendly and AOT-compatible, or have an overload that is
  • Use System.Text.Json to output the JSON representation
    • target frameworks without built-in support as part of the shared framework should use the System.Text.Json NuGet package
  • Use StringSyntaxAttribute.Json for testing
  • Add Benchmarks for relevant public members
  • Set appropriate <TargetFrameworks> for the Library
    • use multi-targeting for the Test project
  • Ensure to be callable/invocable from C#, F#, and Visual Basic

Example

See: https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/sdk#cli-introspection-with---cli-schema

See also

Metadata

Metadata

Assignees

Labels

changelog:addedAdd a new feature (SemVer:MINOR)scope:introspectionThe CLI Introspection librariestype:featRequest/add a new feature (this correlates with MINOR in Semantic Versioning)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions