Skip to content

Commit abc7010

Browse files
committed
Fixed Issue #225/b
1 parent 3f61097 commit abc7010

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/CommandLine/ErrorExtensions.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using CommandLine.Core;
6+
using CommandLine.Infrastructure;
67

78
namespace CommandLine
89
{
@@ -17,7 +18,10 @@ public static ParserResult<T> ToParserResult<T>(this IEnumerable<Error> errors,
1718

1819
public static IEnumerable<Error> OnlyMeaningfulOnes(this IEnumerable<Error> errors)
1920
{
20-
return errors.Where(e => !e.StopsProcessing);
21+
return errors
22+
.Where(e => !e.StopsProcessing)
23+
.Where(e => !(e.Tag == ErrorType.UnknownOptionError
24+
&& ((UnknownOptionError)e).Token.EqualsOrdinalIgnoreCase("help")));
2125
}
2226
}
2327
}

src/CommandLine/Infrastructure/StringExtensions.cs

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public static bool EqualsOrdinal(this string strA, string strB)
4343
return string.CompareOrdinal(strA, strB) == 0;
4444
}
4545

46+
public static bool EqualsOrdinalIgnoreCase(this string strA, string strB)
47+
{
48+
return string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0;
49+
}
50+
4651
public static int SafeLength(this string value)
4752
{
4853
return value == null ? 0 : value.Length;

0 commit comments

Comments
 (0)