Update readme

This commit is contained in:
Tyrrrz
2022-01-11 00:32:56 +02:00
parent 0f7cea4ed1
commit 76f0c77f1e

View File

@@ -168,7 +168,7 @@ In case the user forgets to specify the `value` parameter, the application will
```sh ```sh
> dotnet myapp.dll -b 10 > dotnet myapp.dll -b 10
Missing parameter(s): Missing required parameter(s):
<value> <value>
``` ```
@@ -193,11 +193,12 @@ OPTIONS
Overall, parameters and options are both used to consume input from the command line, but they differ in a few important ways: Overall, parameters and options are both used to consume input from the command line, but they differ in a few important ways:
- Parameters are identified by their relative order. Options are identified by their name or a single-character short name. | | Parameters | Options |
- Parameters technically also have a name, but it's only used in the help text. |--------------------|-------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
- Parameters are always required. Options are normally optional, but can also be configured to require a value. | **Identification** | Positional (by relative order). | Named (by name or short name). |
- Options can be configured to use an environment variable as a fallback. | **Requiredness** | Required by default. Only the last parameter can be configured to be optional. | Optional by default. Any option can be configured to be required without limitations. |
- Both parameters and options can take multiple values, but there can only be one such parameter in a command and it must be the last in order. Options are not limited in this regard. | **Arity** | Depends on the property type. Only the last parameter can be bound to a non-scalar type (i.e. array). | Depends on the property type. Any option can be bound to a non-scalar type without limitations. |
| **Fallback** | — | Can be configured to use an environment variable as fallback, in case the option isn't set. |
As a general guideline, it's recommended to use parameters for required inputs that the command can't function without. As a general guideline, it's recommended to use parameters for required inputs that the command can't function without.
Use options for all other non-required inputs or when specifying the name explicitly makes the usage clearer. Use options for all other non-required inputs or when specifying the name explicitly makes the usage clearer.