mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Default to semantic representation of assembly version in help text
This commit is contained in:
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using CliFx.Domain;
|
||||
using CliFx.Internal;
|
||||
|
||||
namespace CliFx
|
||||
{
|
||||
@@ -194,7 +195,7 @@ namespace CliFx
|
||||
|
||||
private static string? GetDefaultVersionText() =>
|
||||
EntryAssembly != null
|
||||
? $"v{EntryAssembly.GetName().Version}"
|
||||
? $"v{EntryAssembly.GetName().Version.ToSemanticString()}"
|
||||
: null;
|
||||
}
|
||||
}
|
||||
10
CliFx/Internal/VersionExtensions.cs
Normal file
10
CliFx/Internal/VersionExtensions.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace CliFx.Internal
|
||||
{
|
||||
internal static class VersionExtensions
|
||||
{
|
||||
public static string ToSemanticString(this Version version) =>
|
||||
version.Revision <= 0 ? version.ToString(3) : version.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user