- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 520
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
Can render command help and application version from inside a command #1133
Can render command help and application version from inside a command #1133
Conversation
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about this for a while.
Wouldn't it be better if we exposed an interface IHelpWriter
(like you have in this PR) that contains a method to create the help text from a simplified version of CommandModel
?
public interface IHelpProvider
{
IEnumerable<IRenderable> GetHelp(SomeSimplifiedCommandModel model);
}
This way, people could design their help text however they want.
I've been thinking about this as well, and I agree @patriksvensson . It also starts to tie in with this #1093, which is about separating out initialisation/allowing users to register their own concrete implementations in the DI factory ahead of command parsing etc. I'll have a go at updating this PR and resubmit. |
FYI. I'm going to start reworking this PR @patriksvensson. Assuming the help writer improvements in #1252 are generally on point, I'm going to branch from that as a better starting point than main. |
Closing, as superseded by #1259 |
Fully implements #702
Also, starts to introduce a clean entry point for allowing spectre.console users (in the future) to override the default HelpWriter with their own implementation, here is where the DI will need to happen,
Spectre.Console.Cli.CommandExecutor
line 54: