mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Remove the usage of ConsoleColor.DarkGray because it looks bad in some terminals
Fixes #104
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CliFx.Infrastructure;
|
||||
using CliFx.Input;
|
||||
|
||||
@@ -47,9 +46,9 @@ namespace CliFx.Formatting
|
||||
foreach (var value in optionInput.Values)
|
||||
{
|
||||
Write(' ');
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(value);
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
}
|
||||
|
||||
Write(']');
|
||||
@@ -75,9 +74,9 @@ namespace CliFx.Formatting
|
||||
Write('=');
|
||||
|
||||
// Value
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(environmentVariableInput.Value);
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
|
||||
WriteLine();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace CliFx.Formatting
|
||||
Write("at ");
|
||||
|
||||
// Fully qualified method name
|
||||
Write(ConsoleColor.DarkGray, stackFrame.ParentType + '.');
|
||||
Write(stackFrame.ParentType + '.');
|
||||
Write(ConsoleColor.Yellow, stackFrame.MethodName);
|
||||
|
||||
// Method parameters
|
||||
@@ -60,7 +60,7 @@ namespace CliFx.Formatting
|
||||
Write("in ");
|
||||
|
||||
// File path
|
||||
Write(ConsoleColor.DarkGray, stackFrameDirectoryPath);
|
||||
Write(stackFrameDirectoryPath);
|
||||
Write(ConsoleColor.Yellow, stackFrameFileName);
|
||||
|
||||
// Source position
|
||||
@@ -80,7 +80,7 @@ namespace CliFx.Formatting
|
||||
|
||||
// Fully qualified exception type
|
||||
var exceptionType = exception.GetType();
|
||||
Write(ConsoleColor.DarkGray, exceptionType.Namespace + '.');
|
||||
Write(exceptionType.Namespace + '.');
|
||||
Write(ConsoleColor.White, exceptionType.Name);
|
||||
Write(": ");
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CliFx.Formatting
|
||||
|
||||
private void WriteCommandInvocation()
|
||||
{
|
||||
Write(ConsoleColor.DarkGray, _context.ApplicationMetadata.ExecutableName);
|
||||
Write(_context.ApplicationMetadata.ExecutableName);
|
||||
|
||||
// Command name
|
||||
if (!string.IsNullOrWhiteSpace(_context.CommandSchema.Name))
|
||||
@@ -190,9 +190,9 @@ namespace CliFx.Formatting
|
||||
Write(", ");
|
||||
}
|
||||
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(validValue.ToString());
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
}
|
||||
|
||||
Write('.');
|
||||
@@ -269,9 +269,9 @@ namespace CliFx.Formatting
|
||||
Write(", ");
|
||||
}
|
||||
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(validValue.ToString());
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
}
|
||||
|
||||
Write('.');
|
||||
@@ -317,9 +317,9 @@ namespace CliFx.Formatting
|
||||
Write(", ");
|
||||
}
|
||||
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(element.ToString(CultureInfo.InvariantCulture));
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
}
|
||||
|
||||
Write('.');
|
||||
@@ -331,9 +331,9 @@ namespace CliFx.Formatting
|
||||
{
|
||||
Write(ConsoleColor.White, "Default: ");
|
||||
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write(defaultValue.ToString(CultureInfo.InvariantCulture));
|
||||
Write(ConsoleColor.DarkGray, '"');
|
||||
Write('"');
|
||||
Write('.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ internal static partial class PolyfillExtensions
|
||||
key = pair.Key;
|
||||
value = pair.Value;
|
||||
}
|
||||
|
||||
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dic, TKey key) =>
|
||||
dic.TryGetValue(key!, out var result) ? result! : default!;
|
||||
}
|
||||
|
||||
internal static partial class PolyfillExtensions
|
||||
@@ -44,4 +41,13 @@ namespace System.Linq
|
||||
new(source, comparer);
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.Collections.Generic
|
||||
{
|
||||
internal static class PolyfillExtensions
|
||||
{
|
||||
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dic, TKey key) =>
|
||||
dic.TryGetValue(key!, out var result) ? result! : default!;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user