This repository has been archived on 2025-09-07. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
dotnet-installer/src/Microsoft.DotNet.Cli.Utils/CommandContext.cs

30 lines
1 KiB
C#
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
2015-11-01 16:21:10 -08:00
namespace Microsoft.DotNet.Cli.Utils
{
2016-01-05 23:48:50 -08:00
public static class CommandContext
2015-11-01 16:21:10 -08:00
{
2016-01-05 23:48:50 -08:00
public static class Variables
2015-11-01 16:21:10 -08:00
{
private static readonly string Prefix = "DOTNET_CLI_CONTEXT_";
2016-01-05 23:48:50 -08:00
public static readonly string Verbose = Prefix + "VERBOSE";
public static readonly string AnsiPassThru = Prefix + "ANSI_PASS_THRU";
2015-11-01 16:21:10 -08:00
}
private static Lazy<bool> _verbose = new Lazy<bool>(() => Env.GetEnvironmentVariableAsBool(Variables.Verbose));
private static Lazy<bool> _ansiPassThru = new Lazy<bool>(() => Env.GetEnvironmentVariableAsBool(Variables.AnsiPassThru));
2015-11-01 16:21:10 -08:00
public static bool IsVerbose()
{
return _verbose.Value;
}
public static bool ShouldPassAnsiCodesThrough()
{
return _ansiPassThru.Value;
2016-03-25 13:15:36 -07:00
}
2015-11-01 16:21:10 -08:00
}
}