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
Function to render help text #702
Comments
Would be good to add a: public override int Execute(CommandContext context)
{
AnsiConsole.WriteVersion();
} |
Good question, is there a way to call the help? I use a default command and I would like to show the help there |
I need the same, a default command that shows a splash + displays help |
PR (#1133) raised for this issue. If you have time ahead of the review/merge, please checkout the proposed implementation and comment as to the suitability of it, see: https://github.com/spectreconsole/spectre.console/blob/1fba0f97178c5bcf07e0bc51681413a7df199a4f/test/Spectre.Console.Cli.Tests/Data/Commands/DefaultCommand.cs |
I am starting a greenfield application and I just learned today about Spectre.Console & Spectre.Console.Cli. It sounded great so I decided to use it. Very shortly after starting I realized when errors occur (such as user input invalid command, input, etc.) the error is displayed very nicely, but the help is not rendered. I think it's very common (and in my case desirable) to show the help when the user messes up the input. So it should show the error, then immediately write out the help to describe how to use the command. With the current implementation I don't see a way to accomplish that and it looks like this issue targets the problem. Unfortunately it appears this issue has been open a very long time and the pull request to resolve this has been open for a while as well. I was looking forward to using Spectre.Console.CLI but, unfortunately, I guess because of this issue I'll check if System.CommandLine will allow me to do this, and if so, I'll be switching to that framework instead. FWIW: My use case is I would like to provide a custom exception handler. If the exception is due to a problem parsing the input, I would like to display the error and then write help to the console. To accomplish this, I would just need a way to access the help writer from within an exception handler. |
FYI: It appears System.CommandLine supports my use case by default with no extra configuration required. |
@CrossBound I prepared the pull request to help address the issue, it's just waiting for review and could have been expedited if asked. It's a shame you didn't stick around for longer so that we might have been able to accommodate your use case more fully, however thank you for leaving feedback. Needless to say this is not a commercially oriented project and yet the judicious time and effort, delays included in that, does mean the codebase is a very high quality. We'd welcome pull requests if you did want to contribute in the future. |
Is your feature request related to a problem? Please describe.
I was looking to find a way to show command help during execution of a command. For example, I have main command of cli set to display fidglet text. But I want to show command help right after.
Describe the solution you'd like
Ideally, having a function in AnsiConsole or CommandContext to render command help. For example
I am not sure if there exists a function to provide such implementation. If there is, please refer me to that.
The text was updated successfully, but these errors were encountered: