Telemetry PR

This commit is contained in:
Lakshan Fernando 2016-03-25 13:15:36 -07:00 committed by Dan Quirk
commit 6b84a10e57
7 changed files with 181 additions and 46 deletions

View file

@ -14,8 +14,8 @@ namespace Microsoft.DotNet.Cli.Utils
public static readonly string AnsiPassThru = Prefix + "ANSI_PASS_THRU";
}
private static Lazy<bool> _verbose = new Lazy<bool>(() => GetBool(Variables.Verbose));
private static Lazy<bool> _ansiPassThru = new Lazy<bool>(() => GetBool(Variables.AnsiPassThru));
private static Lazy<bool> _verbose = new Lazy<bool>(() => Env.GetBool(Variables.Verbose));
private static Lazy<bool> _ansiPassThru = new Lazy<bool>(() => Env.GetBool(Variables.AnsiPassThru));
public static bool IsVerbose()
{
@ -25,29 +25,6 @@ namespace Microsoft.DotNet.Cli.Utils
public static bool ShouldPassAnsiCodesThrough()
{
return _ansiPassThru.Value;
}
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;
}
}
}
}
}