Skip to content

Commit 8bbb74a

Browse files
committed
final polishing
1 parent 5e6c15f commit 8bbb74a

File tree

3 files changed

+23
-30
lines changed

3 files changed

+23
-30
lines changed

docs/fundamentals/toc.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -934,20 +934,22 @@ items:
934934
href: ../standard/commandline/index.md
935935
- name: Get started tutorial
936936
href: ../standard/commandline/get-started-tutorial.md
937-
- name: Command-line syntax and defining commands, options and arguments
937+
- name: Command-line syntax overview
938938
href: ../standard/commandline/syntax.md
939-
- name: Model binding
940-
href: ../standard/commandline/model-binding.md
941-
- name: Tab completion
939+
- name: How to parse and invoke the result
940+
href: ../standard/commandline/parse-and-invoke.md
941+
- name: How to customize parsing and validation
942+
href: ../standard/commandline/parsing-and-validation.md
943+
- name: How to configure the parser
944+
href: ../standard/commandline/command-line-configuration.md
945+
- name: How to enable and customize tab completion
942946
href: ../standard/commandline/tab-completion.md
943-
- name: Dependency injection
944-
href: ../standard/commandline/dependency-injection.md
945-
- name: Help
947+
- name: How to customize help
946948
href: ../standard/commandline/help.md
947-
- name: Handle termination
948-
href: ../standard/commandline/handle-termination.md
949949
- name: Design guidance
950950
href: ../standard/commandline/design-guidance.md
951+
- name: Breaking changes in beta5
952+
href: ../standard/commandline/beta5.md
951953
- name: File and stream I/O
952954
items:
953955
- name: Overview

docs/standard/commandline/beta5.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ ms.topic: how-to
1414

1515
[!INCLUDE [scl-preview](../../../includes/scl-preview.md)]
1616

17-
Our main focus for beta5 was to improve the APIs to make a step toward releasing a stable version of System.CommandLine. We have simplified the APIs and made them more consistent and coherent with [Framework design guidelines](../design-guidelines/index.md). This article describes the breaking changes that were made in beta5 and the reasoning behind them.
17+
Our main focus for beta5 was to improve the APIs and take a step toward releasing a stable version of System.CommandLine. We have simplified the APIs and made them more consistent and coherent with the [Framework design guidelines](../design-guidelines/index.md). This article describes the breaking changes that were made in beta5 and the reasoning behind them.
1818

1919
## Renaming
2020

21-
In beta4, not all of the types and properties were following the [Framework design guidelines](../design-guidelines/index.md). Some of them were not consistent with the naming conventions, such as using `Is` prefix for boolean properties. In beta5, we made a lot of changes to the API to make it more consistent and coherent with the guidelines. The following table shows the old and new names:
21+
In beta4, not all types and properties followed the [naming guidelines](../design-guidelines/naming-guidelines.md). Some were not consistent with the naming conventions, such as using the `Is` prefix for boolean properties. In beta5, we have renamed some types and properties. The following table shows the old and new names:
2222

2323
| Old name | New name |
2424
|-------------------------------------------------------------|----------------------------------------------------------------|
@@ -35,9 +35,9 @@ In case of the `ErrorMessage` property, we changed the name to `AddError` and ma
3535

3636
## Exposing mutable collections
3737

38-
In beta4, we had a lot of `Add` methods that were used to add items to collections, such as arguments, options, subcommands, validators, and completions. Some of these collections, were exposed via property as readonly collections. Because of that, it was impossible to remove items from those collections.
38+
In beta4, we had many `Add` methods that were used to add items to collections, such as arguments, options, subcommands, validators, and completions. Some of these collections were exposed via properties as read-only collections. Because of that, it was impossible to remove items from those collections.
3939

40-
In beta5, we changed the APIs to expose mutable collections instead of `Add` methods and (sometimes) readonly collections. This allows you to not only add items or enumerate them, but also remove them. The following table shows the old method and new property names:
40+
In beta5, we changed the APIs to expose mutable collections instead of `Add` methods and (sometimes) read-only collections. This allows you to not only add items or enumerate them, but also remove them. The following table shows the old method and new property names:
4141

4242
| Old method name | New property |
4343
|-------------------------------------------------------------|----------------------------------------------------------------|
@@ -57,19 +57,16 @@ The `RemoveAlias` and `HasAlias` methods were also removed, as the `Aliases` pro
5757

5858
## Names and aliases
5959

60-
Before beta5, there was no clear separation between the name and [aliases](syntax.md#aliases) of a symbol. When `name` was not provided for `Option<T>` constructor, the symbol was reporting its name as the longest alias with prefixes like `--`, `-` or `/` removed. That was confusing.
60+
Before beta5, there was no clear separation between the name and [aliases](syntax.md#aliases) of a symbol. When `name` was not provided for the `Option<T>` constructor, the symbol reported its name as the longest alias with prefixes like `--`, `-`, or `/` removed. That was confusing.
6161

62-
Moreover, in order to get the parsed value, users had to store a reference to an option or an argument and then use it to get the value from `ParseResult`.
62+
Moreover, to get the parsed value, users had to store a reference to an option or an argument and then use it to get the value from `ParseResult`.
6363

64-
To promote simplicity and explicitness, we decided to make the name of a symbol a mandatory parameter for every symbol constructor (including `Argument<T>`). We have also separated the concept of a name and aliases, now aliases are just aliases and do not include the name of the symbol. Of course, they are optional. As a result, we made the following changes:
64+
To promote simplicity and explicitness, we decided to make the name of a symbol a mandatory parameter for every symbol constructor (including `Argument<T>`). We have also separated the concept of a name and aliases; now aliases are just aliases and do not include the name of the symbol. Of course, they are optional. As a result, we made the following changes:
6565

66-
67-
This made it difficult to work with symbols that had no aliases or had multiple aliases.
68-
69-
- `name` is now a mandatory argument for every public constructor of `Argument<T>`, `Option<T>`, and `Command`. In case of `Argument<T>`, it is not used for parsing, but to generate the help and completions text. In case of `Option<T>` and `Command`, it is used to identify the symbol during parsing and also for help and completions.
70-
- `Symbol.Name` property is no longer `virtual`, it's also readonly now and it returns the name as it was provided when the symbol was created. Because of that, `Symbol.DefaultName` was removed and `Option.Name` no longer removes the `--`, `-` or `/` or any other prefix from the longest alias.
71-
- The `Aliases` property exposed by `Option` and `Command` is now exposing a mutable collection. This collection no longer includes the name of the symbol.
72-
- `System.CommandLine.Parsing.IdentifierSymbol` was removed.
66+
- `name` is now a mandatory argument for every public constructor of `Argument<T>`, `Option<T>`, and `Command`. In the case of `Argument<T>`, it is not used for parsing, but to generate the help and completions text. In the case of `Option<T>` and `Command`, it is used to identify the symbol during parsing and also for help and completions.
67+
- The `Symbol.Name` property is no longer `virtual`; it's now read-only and returns the name as it was provided when the symbol was created. Because of that, `Symbol.DefaultName` was removed and `Option.Name` no longer removes the `--`, `-`, or `/` or any other prefix from the longest alias.
68+
- The `Aliases` property exposed by `Option` and `Command` is now a mutable collection. This collection no longer includes the name of the symbol.
69+
- `System.CommandLine.Parsing.IdentifierSymbol` was removed (it was a base type for both `Command` and `Option`).
7370

7471
Having the name always present allows for [getting the parsed value by name](parse-and-invoke.md#getvalue):
7572

@@ -234,12 +231,6 @@ To summarize these changes:
234231

235232
For more details about how to use actions, see the [How to parse and invoke commands in System.CommandLine](parse-and-invoke.md) document.
236233

237-
## Libraries
238-
239-
Rendering -> Spectre.Console
240-
Dragonfruit -> the new lib
241-
System.CommandLine.NamingConventionBinder -> stop using reflection to bind symbols to properties
242-
243234
## The benefits of the simplified API
244235

245236
We hope that the changes made in beta5 will make the API more consistent, futureproof and easier to use for existing and new users.

docs/standard/commandline/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ To learn more, see the following resources:
5050
- [How to customize help](help.md)
5151
- [How to enable and customize tab completion](tab-completion.md)
5252
- [Command-line design guidance](design-guidance.md)
53+
- [Breaking changes in beta5](beta5.md)
5354
- [System.CommandLine API reference](xref:System.CommandLine)
54-
- [How to update to beta5](beta5.md)

0 commit comments

Comments
 (0)