-
-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is it possible to use Spectre.Console to render to string? #1677
Comments
Found that I can do it like this: using var writer = new StringWriter();
var console = AnsiConsole.Create(new AnsiConsoleSettings
{
Ansi = AnsiSupport.No,
ColorSystem = ColorSystemSupport.NoColors,
Out = new AnsiConsoleOutput(writer)
});
throw new ArgumentException(writer.ToString()); Works for me, I think. Now I have to figure out how to make those settings global in a best way. |
You can also use the |
@patriksvensson |
Oh, I was under the impression that you wanted to use it for tests. |
I want to use it for tests too, |
Ok, just make sure you take a dependency on |
Is your feature request related to a problem? Please describe.
Spectre.Console is amazing, but I'm not found a good way to combine it with ITestOutputHelper, and other ILogger and similar interfaces. I wish to use it with those at least by writing compatibility layer, but I want render to string for it.
Describe the solution you'd like
I'd like to be able to render to string. With and without colors, because of all the issues with Ansi colors.
Describe alternatives you've considered
Probably there is something like this somewhere in docs or issues, but I wasn't been able to find.
Additional context
ITestOutputHelper fundamentally incompatible with live elements. Due to how it connects to CI/CD and not allows to rewrite lines.
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: