mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-01 01:25:27 +08:00 
			
		
		
		
	Add extension method to use automatic application version
This commit is contained in:
		 Patrik Svensson
					Patrik Svensson
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						Patrik Svensson
					
				
			
						parent
						
							3acc90e47c
						
					
				
				
					commit
					5d4b2c88e5
				
			| @@ -82,7 +82,7 @@ public static class ConfiguratorExtensions | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Overrides the auto-detected version of the application. | ||||
|     /// Sets the version of the application. | ||||
|     /// </summary> | ||||
|     /// <param name="configurator">The configurator.</param> | ||||
|     /// <param name="version">The version of application.</param> | ||||
| @@ -98,6 +98,25 @@ public static class ConfiguratorExtensions | ||||
|         return configurator; | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Uses the version retrieved from the <see cref="AssemblyInformationalVersionAttribute"/> | ||||
|     /// as the application's version. | ||||
|     /// </summary> | ||||
|     /// <param name="configurator">The configurator.</param> | ||||
|     /// <returns>A configurator that can be used to configure the application further.</returns> | ||||
|     public static IConfigurator UseAssemblyInformationalVersion(this IConfigurator configurator) | ||||
|     { | ||||
|         if (configurator == null) | ||||
|         { | ||||
|             throw new ArgumentNullException(nameof(configurator)); | ||||
|         } | ||||
|  | ||||
|         configurator.Settings.ApplicationVersion = | ||||
|             VersionHelper.GetVersion(Assembly.GetEntryAssembly()); | ||||
|  | ||||
|         return configurator; | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Hides the <c>DEFAULT</c> column that lists default values coming from the | ||||
|     /// <see cref="DefaultValueAttribute"/> in the options help text. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user