Skip to content

Commit a0926bf

Browse files
committed
Reverting back genericity from IParser.
1 parent a358596 commit a0926bf

12 files changed

+46
-53
lines changed

CommandLine.sln.DotSettings.user

+1-1
Large diffs are not rendered by default.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Command Line Parser Library 1.9.5.3 rc0 for CLR.
1+
Command Line Parser Library 1.9.6.1 rc1 for CLR.
22
===
33
The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks defining switches, options and verb commands. It allows you to display an help screen with an high degree of customization and a simple way to report syntax errors to the end user. Everything that is boring and repetitive to be programmed stands up on library shoulders, letting developers concentrate on core logic.
44
__This library provides _hassle free_ command line parsing with a constantly updated API since 2005.__

Rakefile.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PRODUCT = "Command Line Parser Library"
22
DESCRIPTION = "The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks."
3-
VERSION = "1.9.5.3"
4-
INF_VERSION = "1.9.5-rc0"
3+
VERSION = "1.9.6.1"
4+
INF_VERSION = "1.9.6-rc1"
55
AUTHOR = "Giacomo Stelluti Scala"
66
COPYRIGHT = "Copyright (c) 2005 - 2013 " + AUTHOR
77
LICENSE_URL = "https://raw.github.com/gsscoder/commandline/master/doc/LICENSE"

doc/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2013-02-22 Giacomo Stelluti Scala <[email protected]>
2+
3+
* Reverting back genericity from IParser.
4+
15
2013-02-21 Giacomo Stelluti Scala <[email protected]>
26

37
* HelpText, internal refactoring to safely suppress a CodeAnalysis warning.

doc/INFO

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Command Line Parser Library
33
Project Author/Coordinator: Giacomo Stelluti Scala
44
Main Contributor(s): Steven Evans, Kevin Moore, Dan Nemec (nemec), Alexander Fast (mizipzor)
55
--------------------------------------------------------------------------------------------
6-
Version 1.9.5.3 rc0 (*1)
7-
Latest Update: 2013-02-21
6+
Version 1.9.6.1 rc1 (*1)
7+
Latest Update: 2013-02-22
88

99
Git home:
1010
https://github.com/gsscoder/commandline

doc/PublicAPI.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ Public API Changes:
1717
- Version 1.9.4.223: Non breaking, added ``IParserSettings::ParsingCulture`` and ``ParserConfigurator::UseCulture``.
1818
- Version 1.9.4.225: Breaking, default singleton parsing culture is ``CultureInfo.InvariantCulture``; this is not general default only the one of default singleton.
1919
- Version 1.9.4.223: 'Partially' non breaking, all attributes are now in root namespace.
20-
- Version 1.9.5.0: Breaking (in some cases), removed ``IParser::ParseArguments`` overloads (see ChangeLog); removed ``::WasVerbOptionInvoked``; use new ``HelpText::AutoBuild(object,string)`` instead of obsolete ``::GetVerbOptionsInstanceByName``.
20+
- Version 1.9.5.0: Breaking (in some cases), removed ``IParser::ParseArguments`` overloads (see ChangeLog); removed ``::WasVerbOptionInvoked``; use new ``HelpText::AutoBuild(object,string)`` instead of obsolete ``::GetVerbOptionsInstanceByName``.
21+
- Version 1.9.6.1: Non breaking (if implicit syntax), reverting back genericity from IParser.

nuget/readme.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
Command Line Parser Library 1.9.5.0 rc0
1+
Command Line Parser Library 1.9.6.1 rc1
22
---------------------------------------
33
Giacomo Stelluti Scala
44
55

66
GitHub (Latest Sources, Updated Docs): https://github.com/gsscoder/commandline
77
Codeplex (Binary Downloads): http://commandline.codeplex.com/
88

9-
Upgrading from < 1.9.5.0 rc0:
9+
Upgrading from < 1.9.6.1 rc1:
1010
-----------------------------
1111
Now CommandLine.Parser is defiend as:
1212
interface CommandLine.IParser {
13-
bool ParseArguments<T>(string[] args, T options) where T : class;
14-
bool ParseArguments<T>(string[] args, T options, Action<string, object> onVerbCommand) where T : class;
15-
bool ParseArgumentsStrict<T>(string[] args, T options, Action onFail = null) where T : class;
16-
bool ParseArgumentsStrict<T>(string[] args, T options, Action<string, object> onVerbCommand, Action onFail = null) where T : class;
13+
bool ParseArguments(string[] args, object options);
14+
bool ParseArguments(string[] args, object options, Action<string, object> onVerbCommand);
15+
bool ParseArgumentsStrict(string[] args, object options, Action onFail = null);
16+
bool ParseArgumentsStrict(string[] args, object options, Action<string, object> onVerbCommand, Action onFail = null);
1717
}
1818
Please refer to wiki (https://github.com/gsscoder/commandline/wiki).
1919
For help screen in verb command scenario use new HelpText::AutoBuild(object,string).

src/SharedAssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
[assembly: AssemblyProduct("Command Line Parser Library")]
3030
[assembly: AssemblyCopyright("Copyright (c) 2005 - 2013 Giacomo Stelluti Scala")]
31-
[assembly: AssemblyVersion("1.9.5.3")]
32-
[assembly: AssemblyFileVersion("1.9.5.3")]
31+
[assembly: AssemblyVersion("1.9.6.1")]
32+
[assembly: AssemblyFileVersion("1.9.6.1")]
3333

34-
[assembly: AssemblyInformationalVersion("1.9.5-rc0")]
34+
[assembly: AssemblyInformationalVersion("1.9.6-rc1")]
3535
[assembly: NeutralResourcesLanguage("en-US")]

src/libcmdline/IParser.cs

+4-8
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,19 @@ public interface IParser
4242
/// Parses a <see cref="System.String"/> array of command line arguments, setting values in <paramref name="options"/>
4343
/// parameter instance's public fields decorated with appropriate attributes.
4444
/// </summary>
45-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
4645
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
4746
/// <param name="options">An instance used to receive values.
4847
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
4948
/// <returns>True if parsing process succeed.</returns>
5049
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
5150
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
52-
bool ParseArguments<T>(string[] args, T options) where T : class;
51+
bool ParseArguments(string[] args, object options);
5352

5453
/// <summary>
5554
/// Parses a <see cref="System.String"/> array of command line arguments with verb commands, setting values in <paramref name="options"/>
5655
/// parameter instance's public fields decorated with appropriate attributes.
5756
/// This overload supports verb commands.
5857
/// </summary>
59-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
6058
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
6159
/// <param name="options">An instance used to receive values.
6260
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
@@ -65,30 +63,28 @@ public interface IParser
6563
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
6664
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
6765
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="onVerbCommand"/> is null.</exception>
68-
bool ParseArguments<T>(string[] args, T options, Action<string, object> onVerbCommand) where T : class;
66+
bool ParseArguments(string[] args, object options, Action<string, object> onVerbCommand);
6967

7068
/// <summary>
7169
/// Parses a <see cref="System.String"/> array of command line arguments, setting values in <paramref name="options"/>
7270
/// parameter instance's public fields decorated with appropriate attributes. If parsing fails, the method invokes
7371
/// the <paramref name="onFail"/> delegate, if null exits with <see cref="Parser.DefaultExitCodeFail"/>.
7472
/// </summary>
75-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
7673
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
7774
/// <param name="options">An object's instance used to receive values.
7875
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
7976
/// <param name="onFail">The <see cref="Action"/> delegate executed when parsing fails.</param>
8077
/// <returns>True if parsing process succeed.</returns>
8178
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
8279
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
83-
bool ParseArgumentsStrict<T>(string[] args, T options, Action onFail = null) where T : class;
80+
bool ParseArgumentsStrict(string[] args, object options, Action onFail = null);
8481

8582
/// <summary>
8683
/// Parses a <see cref="System.String"/> array of command line arguments with verb commands, setting values in <paramref name="options"/>
8784
/// parameter instance's public fields decorated with appropriate attributes. If parsing fails, the method invokes
8885
/// the <paramref name="onFail"/> delegate, if null exits with <see cref="Parser.DefaultExitCodeFail"/>.
8986
/// This overload supports verb commands.
9087
/// </summary>
91-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
9288
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
9389
/// <param name="options">An instance used to receive values.
9490
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
@@ -98,6 +94,6 @@ public interface IParser
9894
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
9995
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
10096
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="onVerbCommand"/> is null.</exception>
101-
bool ParseArgumentsStrict<T>(string[] args, T options, Action<string, object> onVerbCommand, Action onFail = null) where T : class;
97+
bool ParseArgumentsStrict(string[] args, object options, Action<string, object> onVerbCommand, Action onFail = null);
10298
}
10399
}

src/libcmdline/Parser.cs

+6-14
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ namespace CommandLine
4242
public sealed class Parser : IParser, IDisposable
4343
{
4444
/// <summary>
45-
/// Default exit code (1) used by <see cref="Parser.ParseArgumentsStrict&lt;T&gt;(string[],T,Action)"/>
46-
/// and <see cref="Parser.ParseArgumentsStrict&lt;T&gt;(string[],T,Action&lt;string,object&gt;,Action)"/> overloads.
45+
/// Default exit code (1) used by <see cref="Parser.ParseArgumentsStrict(string[],object,Action)"/>
46+
/// and <see cref="Parser.ParseArgumentsStrict(string[],object,Action&lt;string,object&gt;,Action)"/> overloads.
4747
/// </summary>
4848
public const int DefaultExitCodeFail = 1;
4949
private static readonly IParser DefaultParser = new Parser(true);
@@ -132,15 +132,13 @@ public static object GetVerbOptionsInstanceByName(string verb, object target, ou
132132
/// Parses a <see cref="System.String"/> array of command line arguments, setting values in <paramref name="options"/>
133133
/// parameter instance's public fields decorated with appropriate attributes.
134134
/// </summary>
135-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
136135
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
137136
/// <param name="options">An instance used to receive values.
138137
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
139138
/// <returns>True if parsing process succeed.</returns>
140139
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
141140
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
142-
public bool ParseArguments<T>(string[] args, T options)
143-
where T : class
141+
public bool ParseArguments(string[] args, object options)
144142
{
145143
Assumes.NotNull(args, "args", SR.ArgumentNullException_ArgsStringArrayCannotBeNull);
146144
Assumes.NotNull(options, "options", SR.ArgumentNullException_OptionsInstanceCannotBeNull);
@@ -153,7 +151,6 @@ public bool ParseArguments<T>(string[] args, T options)
153151
/// parameter instance's public fields decorated with appropriate attributes.
154152
/// This overload supports verb commands.
155153
/// </summary>
156-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
157154
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
158155
/// <param name="options">An instance used to receive values.
159156
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
@@ -162,8 +159,7 @@ public bool ParseArguments<T>(string[] args, T options)
162159
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
163160
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
164161
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="onVerbCommand"/> is null.</exception>
165-
public bool ParseArguments<T>(string[] args, T options, Action<string, object> onVerbCommand)
166-
where T : class
162+
public bool ParseArguments(string[] args, object options, Action<string, object> onVerbCommand)
167163
{
168164
Assumes.NotNull(args, "args", SR.ArgumentNullException_ArgsStringArrayCannotBeNull);
169165
Assumes.NotNull(options, "options", SR.ArgumentNullException_OptionsInstanceCannotBeNull);
@@ -184,16 +180,14 @@ public bool ParseArguments<T>(string[] args, T options, Action<string, object> o
184180
/// parameter instance's public fields decorated with appropriate attributes. If parsing fails, the method invokes
185181
/// the <paramref name="onFail"/> delegate, if null exits with <see cref="Parser.DefaultExitCodeFail"/>.
186182
/// </summary>
187-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
188183
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
189184
/// <param name="options">An object's instance used to receive values.
190185
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
191186
/// <param name="onFail">The <see cref="Action"/> delegate executed when parsing fails.</param>
192187
/// <returns>True if parsing process succeed.</returns>
193188
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
194189
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
195-
public bool ParseArgumentsStrict<T>(string[] args, T options, Action onFail = null)
196-
where T : class
190+
public bool ParseArgumentsStrict(string[] args, object options, Action onFail = null)
197191
{
198192
Assumes.NotNull(args, "args", SR.ArgumentNullException_ArgsStringArrayCannotBeNull);
199193
Assumes.NotNull(options, "options", SR.ArgumentNullException_OptionsInstanceCannotBeNull);
@@ -223,7 +217,6 @@ public bool ParseArgumentsStrict<T>(string[] args, T options, Action onFail = nu
223217
/// the <paramref name="onFail"/> delegate, if null exits with <see cref="Parser.DefaultExitCodeFail"/>.
224218
/// This overload supports verb commands.
225219
/// </summary>
226-
/// <typeparam name="T">Type of <paramref name="options"/> instance.</typeparam>
227220
/// <param name="args">A <see cref="System.String"/> array of command line arguments.</param>
228221
/// <param name="options">An instance used to receive values.
229222
/// Parsing rules are defined using <see cref="CommandLine.BaseOptionAttribute"/> derived types.</param>
@@ -233,8 +226,7 @@ public bool ParseArgumentsStrict<T>(string[] args, T options, Action onFail = nu
233226
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="args"/> is null.</exception>
234227
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="options"/> is null.</exception>
235228
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="onVerbCommand"/> is null.</exception>
236-
public bool ParseArgumentsStrict<T>(string[] args, T options, Action<string, object> onVerbCommand, Action onFail = null)
237-
where T : class
229+
public bool ParseArgumentsStrict(string[] args, object options, Action<string, object> onVerbCommand, Action onFail = null)
238230
{
239231
Assumes.NotNull(args, "args", SR.ArgumentNullException_ArgsStringArrayCannotBeNull);
240232
Assumes.NotNull(options, "options", SR.ArgumentNullException_OptionsInstanceCannotBeNull);

src/libcmdline/Settings.StyleCop

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<StyleCopSettings Version="105">
2-
<GlobalSettings>
3-
<CollectionProperty Name="RecognizedWords">
4-
<Value>behaviour</Value>
5-
</CollectionProperty>
6-
</GlobalSettings>
7-
<Analyzers>
8-
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
9-
<AnalyzerSettings>
10-
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
11-
<BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
12-
</AnalyzerSettings>
13-
</Analyzer>
14-
</Analyzers>
1+
<StyleCopSettings Version="105">
2+
<GlobalSettings>
3+
<CollectionProperty Name="RecognizedWords">
4+
<Value>behaviour</Value>
5+
</CollectionProperty>
6+
</GlobalSettings>
7+
<Analyzers>
8+
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
9+
<AnalyzerSettings>
10+
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
11+
<BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
12+
</AnalyzerSettings>
13+
</Analyzer>
14+
</Analyzers>
1515
</StyleCopSettings>

src/tests/Unit/Parser/ParserFixture.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void Will_throw_exception_if_arguments_array_is_null()
5151
public void Will_throw_exception_if_options_instance_is_null()
5252
{
5353
Assert.Throws<ArgumentNullException>(
54-
() => new Parser().ParseArguments<object>(new string[] {}, null));
54+
() => new Parser().ParseArguments(new string[] {}, null));
5555
}
5656

5757
[Fact]

0 commit comments

Comments
 (0)