Skip to content

Commit a87277e

Browse files
authored
Adding Enricher for Azure Pipelines (#1675)
1 parent fdc03f2 commit a87277e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Spectre.Console.Enrichment;
2+
3+
internal sealed class AzurePipelinesEnricher : IProfileEnricher
4+
{
5+
public string Name => "AzurePipeline";
6+
7+
public bool Enabled(IDictionary<string, string> environmentVariables)
8+
{
9+
environmentVariables.TryGetValue("TF_BUILD", out var environmentValue);
10+
return !string.IsNullOrWhiteSpace(environmentValue);
11+
}
12+
13+
public void Enrich(Profile profile)
14+
{
15+
profile.Capabilities.Ansi = true;
16+
profile.Capabilities.Legacy = false;
17+
profile.Capabilities.Interactive = false;
18+
profile.Capabilities.Links = false;
19+
}
20+
}

src/Spectre.Console/Enrichment/ProfileEnricher.cs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ internal static class ProfileEnricher
55
private static readonly List<IProfileEnricher> _defaultEnrichers = new List<IProfileEnricher>
66
{
77
new AppVeyorEnricher(),
8+
new AzurePipelinesEnricher(),
89
new BambooEnricher(),
910
new BitbucketEnricher(),
1011
new BitriseEnricher(),

0 commit comments

Comments
 (0)