mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 18:40:50 +08:00 
			
		
		
		
	Adding Enricher for Azure Pipelines (#1675)
This commit is contained in:
		
							
								
								
									
										20
									
								
								src/Spectre.Console/Enrichment/CI/AzurePipelinesEnricher.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/Spectre.Console/Enrichment/CI/AzurePipelinesEnricher.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					namespace Spectre.Console.Enrichment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					internal sealed class AzurePipelinesEnricher : IProfileEnricher
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public string Name => "AzurePipeline";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public bool Enabled(IDictionary<string, string> environmentVariables)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        environmentVariables.TryGetValue("TF_BUILD", out var environmentValue);
 | 
				
			||||||
 | 
					        return !string.IsNullOrWhiteSpace(environmentValue);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void Enrich(Profile profile)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        profile.Capabilities.Ansi = true;
 | 
				
			||||||
 | 
					        profile.Capabilities.Legacy = false;
 | 
				
			||||||
 | 
					        profile.Capabilities.Interactive = false;
 | 
				
			||||||
 | 
					        profile.Capabilities.Links = false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -5,6 +5,7 @@ internal static class ProfileEnricher
 | 
				
			|||||||
    private static readonly List<IProfileEnricher> _defaultEnrichers = new List<IProfileEnricher>
 | 
					    private static readonly List<IProfileEnricher> _defaultEnrichers = new List<IProfileEnricher>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            new AppVeyorEnricher(),
 | 
					            new AppVeyorEnricher(),
 | 
				
			||||||
 | 
					            new AzurePipelinesEnricher(),
 | 
				
			||||||
            new BambooEnricher(),
 | 
					            new BambooEnricher(),
 | 
				
			||||||
            new BitbucketEnricher(),
 | 
					            new BitbucketEnricher(),
 | 
				
			||||||
            new BitriseEnricher(),
 | 
					            new BitriseEnricher(),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user