Skip to content

Commit 923561e

Browse files
ericwjjonsequitur
authored andcommitted
Fix output mode will always be PlainText.
Maybe something larger is out of order, but at the very least even `RenderingPlayground` will stick to `PlainText` unless configured with `[output:ansi]`. With this change, `OutputMode` will remain `Auto` until the first time something is rendered, [here](https://github.com/dotnet/command-line-api/blob/469b7423fa709682c6988513270f14328b9771f9/src/System.CommandLine.Rendering/ConsoleRenderer.cs#L81) at which time the detection will properly determine `Ansi` is OK. Without this, [UseAnsiTerminalWhenAvailable](https://github.com/dotnet/command-line-api/blob/469b7423fa709682c6988513270f14328b9771f9/src/System.CommandLine.Rendering/CommandLineBuilderExtensions.cs#L13) will have `context.Console` be a `SystemConsole` which is not an `ITerminal` hence will yield `PlainText` from [`DetectOutputMode`](https://github.com/dotnet/command-line-api/blob/469b7423fa709682c6988513270f14328b9771f9/src/System.CommandLine.Rendering/ConsoleExtensions.cs#L33).
1 parent 33ece9e commit 923561e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/System.CommandLine.Rendering/CommandLineBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static OutputMode OutputMode(this BindingContext context)
5858
return mode;
5959
}
6060

61-
return context.Console.DetectOutputMode();
61+
return Rendering.OutputMode.Auto;
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)