Convert dotnet-run to System.CommandLine

This commit is contained in:
Krzysztof Wicher 2015-11-20 19:00:56 -08:00
commit 0ecbc0d5fc
11 changed files with 284 additions and 189 deletions

View file

@ -33,12 +33,24 @@ namespace Microsoft.DotNet.Cli.Utils
private static bool GetBool(string name, bool defaultValue = false)
{
var str = Environment.GetEnvironmentVariable(name);
bool value;
if(string.IsNullOrEmpty(str) || !bool.TryParse(str, out value))
if (string.IsNullOrEmpty(str))
{
return defaultValue;
}
return value;
switch (str.ToLowerInvariant())
{
case "true":
case "1":
case "yes":
return true;
case "false":
case "0":
case "no":
return false;
default:
return defaultValue;
}
}
}
}