github dotnet/command-line-api 2.0.0-beta1.20371.2
System.CommandLine v2.0.0-beta1.20371.2

latest releases: 2.0.0-beta4.22272.1, v2.0.0-beta3.22114.1, 2.0.0-beta2.21617.1...
pre-release3 years ago

What's new

  • Moved the documentation from the wiki into the repository so people can make pull requests.

System.CommandLine

  • Added support for setting environment variables using the [env:name=value] directive. (#965) Thanks, @fredrikhr!

  • Made constructors more consistent between Argument<T> and Option<T> to allow specifying getDefaultValue and description.

  • Added ParseResult.ValueForArgument<T>(Argument<T>) and ParseResult.ValueForOption<T>(Option<T>) to combine lookup and conversion into a single method supporting type inference. (#949)

  • Added default values to help output. (#898) Thanks, @NikiforovAll!

  • Help now wraps lines for long option names (#947) Thanks, @apogeeoak!

  • Added SymbolResult.FindResultFor to provide a cleaner way to find the result for a particular Command, Option, or Argument. This is similar to ParseResult.FindResultFor but it can be used within a custom parse delegate (ParseArgument<T>) so that you don't have to traverse the result tree.

  • Improved suggestion APIs to allow replacing the default suggestions, using Argument.Suggestions.Clear(). (#955) Thanks, @jmarolf!

  • Added Option.AddSuggestions and Argument.AddSuggestions methods with overloads to provide a static list of suggestions or a delegate for more dynamic suggestions.

  • Suggestions are now sorted so that the matches closest to what was typed are shown first. (#891) Thanks, @kimsey0!

  • Performance improvements in tokenizer and symbol result lookups.

System.CommandLine.Rendering

Breaking changes

  • Renamed Option.Required to Option.IsRequired.

  • Renamed the delegate type Suggest to SuggestDelegate.

  • Symbol.Aliases and Symbol.RawAliases are now of type IReadOnlyCollection<string> rather than IReadOnlyList<string>.

Don't miss a new command-line-api release

NewReleases is sending notifications on new releases.