зеркало из https://github.com/dotnet/msbuild.git
Colorize TF instead of enclosing it in brackets (#8715)
Example: Recording.2023-04-28.103416.mp4 I like this both because it highlights the TF more clearly and because it saves two characters of line width.
This commit is contained in:
Родитель
d6fe2b00a1
Коммит
0d84706024
|
@ -85,4 +85,14 @@ internal static class AnsiCodes
|
|||
/// Shows/restores the cursor.
|
||||
/// </summary>
|
||||
public const string ShowCursor = "\x1b[?25h";
|
||||
|
||||
public static string Colorize(string? s, TerminalColor color)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
return s ?? "";
|
||||
}
|
||||
|
||||
return $"{CSI}{(int)color}{SetColor}{s}{SetDefaultColor}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,19 +69,3 @@ internal interface ITerminal : IDisposable
|
|||
/// </summary>
|
||||
string RenderColor(TerminalColor color, string text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the text colors supported by <see cref="ITerminal"/>.
|
||||
/// </summary>
|
||||
internal enum TerminalColor
|
||||
{
|
||||
Black = 30,
|
||||
Red = 31,
|
||||
Green = 32,
|
||||
Yellow = 33,
|
||||
Blue = 34,
|
||||
Magenta = 35,
|
||||
Cyan = 36,
|
||||
White = 37,
|
||||
Default = 39
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ internal sealed class LiveLogger : INodeLogger
|
|||
: ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("ProjectBuilding_WithTF",
|
||||
Indentation,
|
||||
Project,
|
||||
TargetFramework,
|
||||
AnsiCodes.Colorize(TargetFramework, TargetFrameworkColor),
|
||||
Target,
|
||||
duration);
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ internal sealed class LiveLogger : INodeLogger
|
|||
/// </summary>
|
||||
private const string Indentation = " ";
|
||||
|
||||
private const TerminalColor TargetFrameworkColor = TerminalColor.Cyan;
|
||||
|
||||
/// <summary>
|
||||
/// Protects access to state shared between the logger callbacks and the rendering thread.
|
||||
/// </summary>
|
||||
|
@ -363,7 +365,7 @@ internal sealed class LiveLogger : INodeLogger
|
|||
Terminal.Write(ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("ProjectFinished_WithTF",
|
||||
Indentation,
|
||||
projectFile,
|
||||
project.TargetFramework,
|
||||
AnsiCodes.Colorize(project.TargetFramework, TargetFrameworkColor),
|
||||
buildResult,
|
||||
duration));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace Microsoft.Build.Logging.LiveLogger;
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the text colors supported by <see cref="ITerminal"/>.
|
||||
/// </summary>
|
||||
internal enum TerminalColor
|
||||
{
|
||||
Black = 30,
|
||||
Red = 31,
|
||||
Green = 32,
|
||||
Yellow = 33,
|
||||
Blue = 34,
|
||||
Magenta = 35,
|
||||
Cyan = 36,
|
||||
White = 37,
|
||||
Default = 39
|
||||
}
|
|
@ -1422,7 +1422,7 @@
|
|||
</comment>
|
||||
</data>
|
||||
<data name="ProjectFinished_WithTF" xml:space="preserve">
|
||||
<value>{0}{1} [{2}] {3} ({4}s)</value>
|
||||
<value>{0}{1} {2} {3} ({4}s)</value>
|
||||
<comment>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1450,7 +1450,7 @@
|
|||
</comment>
|
||||
</data>
|
||||
<data name="ProjectBuilding_WithTF" xml:space="preserve">
|
||||
<value>{0}{1} [{2}] {3} ({4}s)</value>
|
||||
<value>{0}{1} {2} {3} ({4}s)</value>
|
||||
<comment>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1390,8 +1390,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1421,8 +1421,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1389,8 +1389,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1420,8 +1420,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1393,8 +1393,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1424,8 +1424,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1391,8 +1391,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1422,8 +1422,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1383,8 +1383,8 @@ arquivo de resposta.
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1414,8 +1414,8 @@ arquivo de resposta.
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1381,8 +1381,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1412,8 +1412,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1386,8 +1386,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1417,8 +1417,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
|
@ -1382,8 +1382,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectBuilding_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project building including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
@ -1413,8 +1413,8 @@
|
|||
</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ProjectFinished_WithTF">
|
||||
<source>{0}{1} [{2}] {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} [{2}] {3} ({4}s)</target>
|
||||
<source>{0}{1} {2} {3} ({4}s)</source>
|
||||
<target state="new">{0}{1} {2} {3} ({4}s)</target>
|
||||
<note>
|
||||
Project finished summary including target framework information.
|
||||
{0}: indentation - few spaces to visually indent row
|
||||
|
|
Загрузка…
Ссылка в новой задаче