Skip to content

Add OpenCLI Specification Option for System.CommandLine #4

Description

@Flash0ver

Summary

Add System.CommandLine Option for OpenCLI Specification via --open-cli or --opencli.

Remarks

An OpenCLI Description is a single JSON or YAML document that conforms to the OpenCLI Specification.
see: https://opencli.org/#opencli-description

The OpenCLI Specification is built-in to Spectre.Console.Cli through exe cli opencli and exe --help-dump-opencli.
See: https://spectreconsole.net/cli/reference/built-in-command-behaviors/#opencli-command

Features

  • Add a public API that adds an Option<bool> to System.CommandLine applications
    • Option<bool> should not be recursive, to allow to JSONify only the RootCommand
    • Option<bool> should be hidden, to not show in the help output
  • Might accept optional JSON-Serializer options
  • Add a parameter for the OpenCLI Version as enum or struct
  • Mark OpenCLI-Version-related APIs [Experimental]
    • the OpenCLI Specification is currently a draft/proposal in Version 0.1
    • there are still breaking changes to the draft/proposal of Version 0.1
    • documentation should mention the date of the current revision in use
    • see changelog: https://opencli.org/
  • 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://opencli.org/examples

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