Skip to content

Commit a5858ba

Browse files
committed
Update documentation and README.md
1 parent 1bb43c7 commit a5858ba

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Docs/OptionalArgumentsConfig.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Optional arguments can be configured differently. Now you will find out exactly
1515
* [Default Value](#default-value)
1616
* [Value Restrictions](#value-restrictions)
1717
* [Required Options](#required-options)
18+
* [Hidden Options And Aliases](#hidden-options-and-aliases)
1819
* [Context Capture](#context-capture)
1920
* [After Handling Action](#after-handling-action)
2021

@@ -150,6 +151,25 @@ var option = new ValueOption<int>("angle", "a",
150151
isRequired: true);
151152
```
152153

154+
### Hidden Options And Aliases
155+
Sometimes you need to hide an option from being used when printing command-line help. For example, to gradually refuse a deprecated argument name without breaking backwards compatibility. You can make the option hidden as follows:
156+
157+
```cs
158+
var option = new ValueOption<int>("angle", "a",
159+
description: "angle by which you want to rotate the image",
160+
isHidden: true);
161+
```
162+
163+
Another way to maintain backward compatibility is to use aliases. They will not be displayed when printing text, but can be used as an option identifier, just like the short and long names. You can specify option aliases as follows:
164+
165+
```cs
166+
var option = new ValueOption<int>("angle", "a",
167+
description: "angle by which you want to rotate the image",
168+
aliases: ["rotation-angle", "rotation", "A"]);
169+
```
170+
171+
Please note that aliases must be unique like short and long names.
172+
153173
### Context Capture
154174
For multiple value options you can specify the number of arguments to be captured as their value.
155175

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ You can find instructions for connecting **NetArgumentParser** to your project [
6262
**NetArgumentParser** is currently under development. There are some features that need to be added to the project:
6363
- Add support of subcommands.
6464
- Add support of reflection-based configuring option set using special attributes.
65-
- Add support of hidden arguments and aliases.
6665
- Add support of import and export JSON configuration.
6766
- Add support of parent parsers.
6867
- Add NuGet package.

0 commit comments

Comments
 (0)