From 31a5e17a459bd625da70fdacd889136e7394f68e Mon Sep 17 00:00:00 2001 From: Patrik Svensson Date: Tue, 19 Jan 2021 18:05:25 +0100 Subject: [PATCH] Remove InteractivityDetector --- .../Backends/InteractivityDetector.cs | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/Spectre.Console/Internal/Backends/InteractivityDetector.cs diff --git a/src/Spectre.Console/Internal/Backends/InteractivityDetector.cs b/src/Spectre.Console/Internal/Backends/InteractivityDetector.cs deleted file mode 100644 index bd9e7bc..0000000 --- a/src/Spectre.Console/Internal/Backends/InteractivityDetector.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Spectre.Console -{ - internal static class InteractivityDetector - { - private static readonly Dictionary> _environmentVariables; - - static InteractivityDetector() - { - _environmentVariables = new Dictionary> - { - { "APPVEYOR", v => !string.IsNullOrWhiteSpace(v) }, - { "bamboo_buildNumber", v => !string.IsNullOrWhiteSpace(v) }, - { "BITBUCKET_REPO_OWNER", v => !string.IsNullOrWhiteSpace(v) }, - { "BITBUCKET_REPO_SLUG", v => !string.IsNullOrWhiteSpace(v) }, - { "BITBUCKET_COMMIT", v => !string.IsNullOrWhiteSpace(v) }, - { "BITRISE_BUILD_URL", v => !string.IsNullOrWhiteSpace(v) }, - { "ContinuaCI.Version", v => !string.IsNullOrWhiteSpace(v) }, - { "CI_SERVER", v => v.Equals("yes", StringComparison.OrdinalIgnoreCase) }, // GitLab - { "GITHUB_ACTIONS", v => v.Equals("true", StringComparison.OrdinalIgnoreCase) }, - { "GO_SERVER_URL", v => !string.IsNullOrWhiteSpace(v) }, - { "JENKINS_URL", v => !string.IsNullOrWhiteSpace(v) }, - { "BuildRunner", v => v.Equals("MyGet", StringComparison.OrdinalIgnoreCase) }, - { "TEAMCITY_VERSION", v => !string.IsNullOrWhiteSpace(v) }, - { "TF_BUILD", v => !string.IsNullOrWhiteSpace(v) }, // TFS and Azure - { "TRAVIS", v => !string.IsNullOrWhiteSpace(v) }, - }; - } - - public static bool IsInteractive() - { - if (!Environment.UserInteractive) - { - return false; - } - - foreach (var variable in _environmentVariables) - { - var func = variable.Value; - var value = Environment.GetEnvironmentVariable(variable.Key); - if (!string.IsNullOrWhiteSpace(value) && variable.Value(value)) - { - return false; - } - } - - return true; - } - } -}