Skip to content

Commit 4b52a90

Browse files
committed
Minor HelpText refactoring.
1 parent 48aa004 commit 4b52a90

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

CommandLine.sln.DotSettings.user

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

doc/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Fixed issue #6.
77
* Using VSSTUDIO CodeAnalysis instead of FxCop.
88
* CSharp and VB.NET template updated.
9+
* Minor refactoring on HelpText.
910

1011
2013-02-19 Giacomo Stelluti Scala <[email protected]>
1112

src/libcmdline/Text/HelpText.cs

+4-17
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,9 @@ public static HelpText AutoBuild(object options)
274274
/// An instance of <see cref="CommandLine.Text.HelpText"/> class.
275275
/// </returns>
276276
/// <param name='options'>The instance that collected command line arguments parsed with <see cref="Parser"/> class.</param>
277-
/// <param name='errDelegate'>A delegate used to customize the text block for reporting parsing errors.</param>
278-
public static HelpText AutoBuild(object options, Action<HelpText> errDelegate)
279-
{
280-
return AutoBuild(options, errDelegate, false);
281-
}
282-
283-
/// <summary>
284-
/// Creates a new instance of the <see cref="CommandLine.Text.HelpText"/> class using common defaults.
285-
/// </summary>
286-
/// <returns>
287-
/// An instance of <see cref="CommandLine.Text.HelpText"/> class.
288-
/// </returns>
289-
/// <param name='options'>The instance that collected command line arguments parsed with <see cref="Parser"/> class.</param>
290-
/// <param name='errDelegate'>A delegate used to customize the text block for reporting parsing errors.</param>
277+
/// <param name='onError'>A delegate used to customize the text block for reporting parsing errors.</param>
291278
/// <param name="verbsIndex">If true the output style is consistent with verb commands (no dashes), otherwise it outputs options.</param>
292-
public static HelpText AutoBuild(object options, Action<HelpText> errDelegate, bool verbsIndex)
279+
public static HelpText AutoBuild(object options, Action<HelpText> onError, bool verbsIndex = false)
293280
{
294281
var auto = new HelpText
295282
{
@@ -299,12 +286,12 @@ public static HelpText AutoBuild(object options, Action<HelpText> errDelegate, b
299286
AddDashesToOption = !verbsIndex
300287
};
301288

302-
if (errDelegate != null)
289+
if (onError != null)
303290
{
304291
var list = ReflectionUtil.RetrievePropertyList<ParserStateAttribute>(options);
305292
if (list != null)
306293
{
307-
errDelegate(auto);
294+
onError(auto);
308295
}
309296
}
310297

0 commit comments

Comments
 (0)