spectreconsole / spectre.console

A .NET library that makes it easier to create beautiful console applications.
https://spectreconsole.net
MIT License
8.9k stars 454 forks source link

ValidationResult.Error should accept/support markup string when returing from CommandSettings.Validate method. #1556

Open psulek opened 1 month ago

psulek commented 1 month ago

Is your feature request related to a problem? Please describe.

ValidationResult.Error method should accept/support markup string when returning from CommandSettings.Validate method.

In Validate method of my CommndSettings i want to return such error:

return ValidationResult.Error($"Option [red]encrypt[/] or [red]decrypt[/] is required.");

But it is not supported right now and is printed as is, without markup support.

Describe the solution you'd like Add Error overload which accepts Spectre.Console.Text or add another parameter to existing Error to named bool markup which will convert string to markup string if true.

Describe alternatives you've considered Dont find any workaround.

Additional context


Please upvote :+1: this issue if you are interested in it.

patriksvensson commented 1 month ago

Sounds reasonable 👍