/// <summary> /// Prints information on terminal support for ANSI escape codes and colors. /// </summary> public static void PrintFeatureSupport(Console.Config.Feature feature) { void Colorize(string prefix, bool value) { var color = Color.Red; if (value) { color = Color.Green; } Console.Write(prefix); Console.WriteLine(value.ToString(), color); } void InBold(string value) { Console.Bold = true; Console.WriteLine(value); Console.Bold = false; } var config = feature; InBold(feature.Name); Colorize("\tHas support? ", config.IsSupported); Colorize("\tIgnores support? ", config.IsIgnoringSupport); Colorize("\tEnabled? ", config.IsEnabled); Colorize("\tIn Effect? ", config.InEffect); }
/// <summary> /// Turns on/off a feature and prints its status. /// </summary> /// <param name="feature">The feature to enable/disable.</param> private static void ToggleFeatureUsage(Console.Config.Feature feature) { feature.Toggle(); Console.WriteLine("Turned usage for: " + feature.Name); PrintFeatureSupport(feature); }
/// <summary> /// Turns on/off support override for a feature and prints its status. /// </summary> /// <param name="feature">The feature for which to ignore support.</param> private static void ToggleFeatureSupport(Console.Config.Feature feature) { feature.IgnoreSupport = !feature.IsIgnoringSupport; Console.WriteLine("Turned support override for: " + feature.Name); PrintFeatureSupport(feature); }