mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-10-31 14:00:21 +00:00 
			
		
		
		
	Add UpdateMetadataCommands to update build time
This commit is contained in:
		
							parent
							
								
									ecbe75a3e3
								
							
						
					
					
						commit
						5d74df36a8
					
				
							
								
								
									
										26
									
								
								app/Build/Commands/UpdateMetadataCommands.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Build/Commands/UpdateMetadataCommands.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | namespace Build.Commands; | ||||||
|  | 
 | ||||||
|  | // ReSharper disable ClassNeverInstantiated.Global | ||||||
|  | // ReSharper disable UnusedType.Global | ||||||
|  | // ReSharper disable UnusedMember.Global | ||||||
|  | 
 | ||||||
|  | public sealed class UpdateMetadataCommands | ||||||
|  | { | ||||||
|  |     [Command("test", Description = "Test command")] | ||||||
|  |     public async Task Test() | ||||||
|  |     { | ||||||
|  |         await this.UpdateBuildTime(); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     private async Task UpdateBuildTime() | ||||||
|  |     { | ||||||
|  |         var pathMetadata = Environment.GetMetadataPath(); | ||||||
|  |         var lines = await File.ReadAllLinesAsync(pathMetadata, Encoding.UTF8); | ||||||
|  |         var buildTime = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " UTC"; | ||||||
|  | 
 | ||||||
|  |         Console.WriteLine($"- Updating build time from '{lines[1]}' to '{buildTime}'."); | ||||||
|  |          | ||||||
|  |         lines[1] = buildTime; | ||||||
|  |         await File.WriteAllLinesAsync(pathMetadata, lines, Encoding.UTF8); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -3,4 +3,5 @@ | |||||||
| var builder = CoconaApp.CreateBuilder(); | var builder = CoconaApp.CreateBuilder(); | ||||||
| var app = builder.Build(); | var app = builder.Build(); | ||||||
| app.AddCommands<CheckRidsCommand>(); | app.AddCommands<CheckRidsCommand>(); | ||||||
|  | app.AddCommands<UpdateMetadataCommands>(); | ||||||
| app.Run(); | app.Run(); | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user