You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/OptionalArgumentsConfig.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ Optional arguments can be configured differently. Now you will find out exactly
15
15
*[Default Value](#default-value)
16
16
*[Value Restrictions](#value-restrictions)
17
17
*[Required Options](#required-options)
18
+
*[Hidden Options And Aliases](#hidden-options-and-aliases)
18
19
*[Context Capture](#context-capture)
19
20
*[After Handling Action](#after-handling-action)
20
21
@@ -150,6 +151,25 @@ var option = new ValueOption<int>("angle", "a",
150
151
isRequired: true);
151
152
```
152
153
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
+
varoption=newValueOption<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
+
varoption=newValueOption<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
+
153
173
### Context Capture
154
174
For multiple value options you can specify the number of arguments to be captured as their value.
0 commit comments