32 lines
816 B
C#
32 lines
816 B
C#
using System;
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
{
|
|
public class EnvVars
|
|
{
|
|
public static readonly bool Verbose = GetBool("DOTNET_BUILD_VERBOSE");
|
|
|
|
private static bool GetBool(string name, bool defaultValue = false)
|
|
{
|
|
var str = Environment.GetEnvironmentVariable(name);
|
|
if (string.IsNullOrEmpty(str))
|
|
{
|
|
return defaultValue;
|
|
}
|
|
|
|
switch (str.ToLowerInvariant())
|
|
{
|
|
case "true":
|
|
case "1":
|
|
case "yes":
|
|
return true;
|
|
case "false":
|
|
case "0":
|
|
case "no":
|
|
return false;
|
|
default:
|
|
return defaultValue;
|
|
}
|
|
}
|
|
}
|
|
}
|