Skip to content

System.CommandLine v2.0.0-beta1.20371.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@jonsequitur jonsequitur released this 23 Jul 15:38
f2556ca

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>.