Skip to content

Commit

Permalink
Update documentation and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yakovypg committed Aug 1, 2024
1 parent 1bb43c7 commit a5858ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Docs/OptionalArgumentsConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Optional arguments can be configured differently. Now you will find out exactly
* [Default Value](#default-value)
* [Value Restrictions](#value-restrictions)
* [Required Options](#required-options)
* [Hidden Options And Aliases](#hidden-options-and-aliases)
* [Context Capture](#context-capture)
* [After Handling Action](#after-handling-action)

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

### Hidden Options And Aliases
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:

```cs
var option = new ValueOption<int>("angle", "a",
description: "angle by which you want to rotate the image",
isHidden: true);
```

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:

```cs
var option = new ValueOption<int>("angle", "a",
description: "angle by which you want to rotate the image",
aliases: ["rotation-angle", "rotation", "A"]);
```

Please note that aliases must be unique like short and long names.

### Context Capture
For multiple value options you can specify the number of arguments to be captured as their value.

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ You can find instructions for connecting **NetArgumentParser** to your project [
**NetArgumentParser** is currently under development. There are some features that need to be added to the project:
- Add support of subcommands.
- Add support of reflection-based configuring option set using special attributes.
- Add support of hidden arguments and aliases.
- Add support of import and export JSON configuration.
- Add support of parent parsers.
- Add NuGet package.
Expand Down

0 comments on commit a5858ba

Please sign in to comment.