Skip to content

Commit 4263dc9

Browse files
authored
Merge pull request #367 from asherber/getversion
Make get-version -v friendlier
2 parents 9880338 + d12fda4 commit 4263dc9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/nbgv/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Nerdbank.GitVersioning.Tool
55
using System.CommandLine;
66
using System.IO;
77
using System.Linq;
8+
using System.Reflection;
89
using System.Threading;
910
using System.Threading.Tasks;
1011
using Newtonsoft.Json;
@@ -25,6 +26,8 @@ internal class Program
2526

2627
private const string DefaultRef = "HEAD";
2728

29+
private const BindingFlags CaseInsensitiveFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase;
30+
2831
private enum ExitCodes
2932
{
3033
OK,
@@ -293,8 +296,8 @@ private static ExitCodes OnGetVersionCommand(string projectPath, string format,
293296
Console.WriteLine("Version: {0}", oracle.Version);
294297
Console.WriteLine("AssemblyVersion: {0}", oracle.AssemblyVersion);
295298
Console.WriteLine("AssemblyInformationalVersion: {0}", oracle.AssemblyInformationalVersion);
296-
Console.WriteLine("NuGet package Version: {0}", oracle.NuGetPackageVersion);
297-
Console.WriteLine("NPM package Version: {0}", oracle.NpmPackageVersion);
299+
Console.WriteLine("NuGetPackageVersion: {0}", oracle.NuGetPackageVersion);
300+
Console.WriteLine("NpmPackageVersion: {0}", oracle.NpmPackageVersion);
298301
break;
299302
case "json":
300303
var converters = new JsonConverter[]
@@ -316,7 +319,7 @@ private static ExitCodes OnGetVersionCommand(string projectPath, string format,
316319
return ExitCodes.UnsupportedFormat;
317320
}
318321

319-
var property = oracle.GetType().GetProperty(singleVariable);
322+
var property = oracle.GetType().GetProperty(singleVariable, CaseInsensitiveFlags);
320323
if (property == null)
321324
{
322325
Console.Error.WriteLine("Variable \"{0}\" not a version property.", singleVariable);

0 commit comments

Comments
 (0)