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
vartokens=GetoptTokenizer.Tokenize(arguments, name =>NameLookup.Contains(name,optionSpecs,nameComparer),ignoreUnknownArguments,enableDashDash,posixlyCorrect);
134
-
varexplodedTokens=GetoptTokenizer.ExplodeOptionList(tokens, name =>NameLookup.HavingSeparator(name,optionSpecs,nameComparer));
104
+
varexplodedTokens=Tokenizer.ExplodeOptionList(tokens, name =>NameLookup.HavingSeparator(name,optionSpecs,nameComparer));
Copy file name to clipboardExpand all lines: src/CommandLine/ParserSettings.cs
+35-10Lines changed: 35 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,14 @@
9
9
10
10
namespaceCommandLine
11
11
{
12
+
publicenumParserMode
13
+
{
14
+
Legacy,
15
+
Getopt,
16
+
17
+
Default=Legacy
18
+
}
19
+
12
20
/// <summary>
13
21
/// Provides settings for <see cref="CommandLine.Parser"/>. Once consumed cannot be reused.
14
22
/// </summary>
@@ -27,7 +35,7 @@ public class ParserSettings : IDisposable
27
35
privateMaybe<bool>enableDashDash;
28
36
privateintmaximumDisplayWidth;
29
37
privateMaybe<bool>allowMultiInstance;
30
-
privateboolgetoptMode;
38
+
privateParserModeparserMode;
31
39
privateMaybe<bool>posixlyCorrect;
32
40
33
41
/// <summary>
@@ -41,7 +49,7 @@ public ParserSettings()
41
49
autoVersion=true;
42
50
parsingCulture=CultureInfo.InvariantCulture;
43
51
maximumDisplayWidth=GetWindowWidth();
44
-
getoptMode=false;
52
+
parserMode=ParserMode.Default;
45
53
enableDashDash=Maybe.Nothing<bool>();
46
54
allowMultiInstance=Maybe.Nothing<bool>();
47
55
posixlyCorrect=Maybe.Nothing<bool>();
@@ -166,11 +174,11 @@ public bool AutoVersion
166
174
/// <summary>
167
175
/// Gets or sets a value indicating whether enable double dash '--' syntax,
168
176
/// that forces parsing of all subsequent tokens as values.
169
-
/// If GetoptMode is true, this defaults to true, but can be turned off by explicitly specifying EnableDashDash = false.
177
+
/// Normally defaults to false. If ParserMode = ParserMode.Getopt, this defaults to true, but can be turned off by explicitly specifying EnableDashDash = false.
/// Whether strict getopt-like processing is applied to option values; if true, AllowMultiInstance and EnableDashDash will default to true as well.
205
+
/// Set this to change how the parser processes command-line arguments. Currently valid values are:
206
+
/// <list>
207
+
/// <item>
208
+
/// <term>Legacy</term>
209
+
/// <description>Uses - for short options and -- for long options.
210
+
/// Values of long options can only start with a - character if the = syntax is used.
211
+
/// E.g., "--string-option -x" will consider "-x" to be an option, not the value of "--string-option",
212
+
/// but "--string-option=-x" will consider "-x" to be the value of "--string-option".</description>
213
+
/// </item>
214
+
/// <item>
215
+
/// <term>Getopt</term>
216
+
/// <description>Strict getopt-like processing is applied to option values.
217
+
/// Mostly like legacy mode, except that option values with = and with space are more consistent.
218
+
/// After an option that takes a value, and whose value was not specified with "=", the next argument will be considered the value even if it starts with "-".
219
+
/// E.g., both "--string-option=-x" and "--string-option -x" will consider "-x" to be the value of "--string-option".
220
+
/// If this mode is chosen, AllowMultiInstance and EnableDashDash will default to true as well, though they can be explicitly turned off if desired.</description>
0 commit comments