From cd5356306a28d8f01040913beb5badc6266735e7 Mon Sep 17 00:00:00 2001 From: Fumblesneeze Date: Sun, 17 Dec 2017 13:22:24 +0100 Subject: [PATCH 1/4] Expose TypeInfo on ParserResult --- src/CommandLine/ParserResult.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CommandLine/ParserResult.cs b/src/CommandLine/ParserResult.cs index 5ec4c073..20761ada 100644 --- a/src/CommandLine/ParserResult.cs +++ b/src/CommandLine/ParserResult.cs @@ -6,7 +6,7 @@ namespace CommandLine { - sealed class TypeInfo + public sealed class TypeInfo { private readonly Type current; private readonly IEnumerable choices; @@ -27,12 +27,12 @@ public IEnumerable Choices get { return this.choices; } } - public static TypeInfo Create(Type current) + internal static TypeInfo Create(Type current) { return new TypeInfo(current, Enumerable.Empty()); } - public static TypeInfo Create(Type current, IEnumerable choices) + internal static TypeInfo Create(Type current, IEnumerable choices) { return new TypeInfo(current, choices); } @@ -78,7 +78,7 @@ public ParserResultType Tag get { return this.tag; } } - internal TypeInfo TypeInfo + public TypeInfo TypeInfo { get { return typeInfo; } } @@ -216,4 +216,4 @@ public bool Equals(NotParsed other) && Errors.SequenceEqual(other.Errors); } } -} \ No newline at end of file +} From 20626b9b5fcc2da744fcd96f9f396e1db15f7f28 Mon Sep 17 00:00:00 2001 From: Niklas Karl Date: Thu, 25 Jan 2018 11:09:13 +0100 Subject: [PATCH 2/4] properly handle CaseInsensitiveEnumValues flag. --- src/CommandLine/Core/InstanceChooser.cs | 6 ++++-- src/CommandLine/Parser.cs | 1 + tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CommandLine/Core/InstanceChooser.cs b/src/CommandLine/Core/InstanceChooser.cs index f68216b1..66e0e91c 100644 --- a/src/CommandLine/Core/InstanceChooser.cs +++ b/src/CommandLine/Core/InstanceChooser.cs @@ -17,6 +17,7 @@ public static ParserResult Choose( IEnumerable types, IEnumerable arguments, StringComparer nameComparer, + bool ignoreValueCase, CultureInfo parsingCulture, IEnumerable nonFatalErrors) { @@ -36,7 +37,7 @@ public static ParserResult Choose( arguments.Skip(1).FirstOrDefault() ?? string.Empty, nameComparer)) : preprocCompare("version") ? MakeNotParsed(types, new VersionRequestedError()) - : MatchVerb(tokenizer, verbs, arguments, nameComparer, parsingCulture, nonFatalErrors); + : MatchVerb(tokenizer, verbs, arguments, nameComparer, ignoreValueCase, parsingCulture, nonFatalErrors); }; return arguments.Any() @@ -49,6 +50,7 @@ private static ParserResult MatchVerb( IEnumerable> verbs, IEnumerable arguments, StringComparer nameComparer, + bool ignoreValueCase, CultureInfo parsingCulture, IEnumerable nonFatalErrors) { @@ -60,7 +62,7 @@ private static ParserResult MatchVerb( tokenizer, arguments.Skip(1), nameComparer, - false, + ignoreValueCase, parsingCulture, nonFatalErrors) : MakeNotParsed(verbs.Select(v => v.Item2), new BadVerbSelectedError(arguments.First())); diff --git a/src/CommandLine/Parser.cs b/src/CommandLine/Parser.cs index a1c5cbdf..1856e6c7 100644 --- a/src/CommandLine/Parser.cs +++ b/src/CommandLine/Parser.cs @@ -156,6 +156,7 @@ public ParserResult ParseArguments(IEnumerable args, params Type types, args, settings.NameComparer, + settings.CaseInsensitiveEnumValues, settings.ParsingCulture, HandleUnknownArguments(settings.IgnoreUnknownArguments)), settings); diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs index 96d175b1..29b0394b 100644 --- a/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs +++ b/tests/CommandLine.Tests/Unit/Core/InstanceChooserTests.cs @@ -22,6 +22,7 @@ private static ParserResult InvokeChoose( types, arguments, StringComparer.Ordinal, + false, CultureInfo.InvariantCulture, Enumerable.Empty()); } From 13c5911ea7aff777e381ccad69d2c4191e273252 Mon Sep 17 00:00:00 2001 From: Dan Schnau Date: Thu, 6 Sep 2018 22:16:09 -0400 Subject: [PATCH 3/4] Add a link to the nuget package in README Just to make life a bit eaiser --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f031da2..248e49b0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ __This library provides _hassle free_ command line parsing with a constantly upd You can utilize the parser library in several ways: -- Install via Nuget/Paket +- Install via Nuget/Paket: [https://www.nuget.org/packages/CommandLineParser/](https://www.nuget.org/packages/CommandLineParser/) - Integrate directly into your project by copying the .cs files into your project. - ILMerge during your build process. From c7e1e575dca3a467b98a44b52a75087915ab12cd Mon Sep 17 00:00:00 2001 From: yiabiten Date: Thu, 4 Oct 2018 21:05:54 +0100 Subject: [PATCH 4/4] Fix #197 --- src/CommandLine/Text/HeadingInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CommandLine/Text/HeadingInfo.cs b/src/CommandLine/Text/HeadingInfo.cs index 286a1872..c8544546 100644 --- a/src/CommandLine/Text/HeadingInfo.cs +++ b/src/CommandLine/Text/HeadingInfo.cs @@ -57,7 +57,7 @@ public static HeadingInfo Default { var title = ReflectionHelper.GetAttribute() .MapValueOrDefault( - titleAttribute => Path.GetFileNameWithoutExtension(titleAttribute.Title), + titleAttribute => titleAttribute.Title, ReflectionHelper.GetAssemblyName()); var version = ReflectionHelper.GetAttribute() .MapValueOrDefault(