Prepend 'v' to default version text

This commit is contained in:
Alexey Golub
2019-08-21 15:52:56 +03:00
parent 31dd24d189
commit df01dc055e
2 changed files with 3 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ namespace CliFx.Tests
{
private static string DummyFilePath => typeof(Dummy.Program).Assembly.Location;
private static string DummyVersionText => typeof(Dummy.Program).Assembly.GetName().Version.ToString();
private static string DummyVersionText => $"v{typeof(Dummy.Program).Assembly.GetName().Version}";
[Test]
[TestCase("", "Hello world")]

View File

@@ -94,13 +94,11 @@ namespace CliFx
{
if (_title.IsNullOrWhiteSpace())
{
// Entry assembly is null in tests
UseTitle(EntryAssembly?.GetName().Name ?? "App");
}
if (_executableName.IsNullOrWhiteSpace())
{
// Entry assembly is null in tests
var entryAssemblyLocation = EntryAssembly?.Location;
// Set different executable name depending on location
@@ -126,8 +124,7 @@ namespace CliFx
if (_versionText.IsNullOrWhiteSpace())
{
// Entry assembly is null in tests
UseVersionText(EntryAssembly?.GetName().Version.ToString() ?? "1.0");
UseVersionText(EntryAssembly != null ? $"v{EntryAssembly.GetName().Version}" : "v1.0");
}
if (_console == null)
@@ -161,6 +158,7 @@ namespace CliFx
{
private static readonly Lazy<Assembly> LazyEntryAssembly = new Lazy<Assembly>(Assembly.GetEntryAssembly);
// Entry assembly is null in tests
private static Assembly EntryAssembly => LazyEntryAssembly.Value;
}
}