@@ -406,18 +406,27 @@ public void PrintHelp()
406406 /// <summary>
407407 /// Return the version of this program.
408408 /// </summary>
409- public string GetVersion ( )
409+ public string GetVersion ( bool includeGitCommit )
410410 {
411411 var assembly = System . Reflection . Assembly . GetExecutingAssembly ( ) ;
412- return System . Reflection . CustomAttributeExtensions . GetCustomAttribute < System . Reflection . AssemblyInformationalVersionAttribute > ( assembly ) . InformationalVersion ;
412+ var version = System . Reflection . CustomAttributeExtensions . GetCustomAttribute < System . Reflection . AssemblyInformationalVersionAttribute > ( assembly ) . InformationalVersion ;
413+
414+ if ( ! includeGitCommit ) {
415+ var plusIndex = version . IndexOf ( '+' ) ;
416+ if ( plusIndex > 0 ) {
417+ version = version . Substring ( 0 , plusIndex ) ;
418+ }
419+ }
420+
421+ return version ;
413422 }
414423
415424 /// <summary>
416425 /// Print the program name and version to the console.
417426 /// </summary>
418427 public void PrintVersion ( )
419428 {
420- Console . WriteLine ( $ "{ PROGRAM_NAME } v{ GetVersion ( ) } ") ;
429+ Console . WriteLine ( $ "{ PROGRAM_NAME } v{ GetVersion ( verbose > 0 ) } ") ;
421430 }
422431
423432 // -------- Global --------
@@ -479,7 +488,7 @@ public async Task<UnityVersion> Setup(bool avoidCacheUpate = false)
479488 . AddNiceConsole ( level , false ) ;
480489 Logger = factory . CreateLogger < InstallUnityCLI > ( ) ;
481490
482- Logger . LogInformation ( $ "{ PROGRAM_NAME } v{ GetVersion ( ) } ") ;
491+ Logger . LogInformation ( $ "{ PROGRAM_NAME } v{ GetVersion ( true ) } ") ;
483492 if ( level != LogLevel . Warning ) Logger . LogInformation ( $ "Log level set to { level } ") ;
484493
485494 // Create installer instance
@@ -712,7 +721,7 @@ static bool IsNewerPatch(UnityVersion version, UnityVersion installed)
712721
713722 public async Task ListUpdates ( )
714723 {
715- Console . WriteLine ( $ "{ PROGRAM_NAME } v{ GetVersion ( ) } , use --help to show usage") ;
724+ Console . WriteLine ( $ "{ PROGRAM_NAME } v{ GetVersion ( false ) } , use --help to show usage") ;
716725
717726 // Force scanning for prerelease versions
718727 versionArgument = new UnityVersion ( type : UnityVersion . Type . Alpha ) ;
0 commit comments