Help command and --help flag should render markdown#6
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert MetadataHelpProvider.GetRootHelp to generate markdown with ## headings, bullet lists, and backtick formatting - Fix CliHost.WriteRootFlag to render via MarkdownRenderer.RenderToAnsi instead of plain stdout.WriteLine - Fix HelpCommand.RunAsync to display markdown in a fullscreen Terminal.Gui Markdown viewer using RunnableWrapper - Add tests for --help ANSI output, help --cat, and MetadataHelpProvider markdown generation Fixes #5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on tests The help command's TUI viewer rendered empty content because Markdown.Text was set before the view was initialized/laid out. Following the pattern from gui-cs/clet's MarkdownClet, set the text inside the Initialized event handler on the containing Runnable. Also switches from RunnableWrapper to a plain Runnable with an embedded Markdown view — the help viewer is read-only and needs no result extraction. Adds integration tests using Application.Create()/Init(ansi) with StopAfterFirstIteration to verify: - The TUI renders without hanging - Driver contents contain expected command text - Subcommand help renders correctly - RenderCatAsync produces ANSI output Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5
Problem
example-app helplaunches TUI butHelpCommand.RunAsyncjust returns markdown as aCommandResult— doesn't display it in a Terminal.GuiMarkdownviewer.example-app --helpwrites plain text directly viastdout.WriteLinewithout ANSI markdown rendering.MetadataHelpProvider.GetRootHelpgenerates plain text, not markdown.Plan
1. Convert
MetadataHelpProvider.GetRootHelpto generate markdownUse
##headings, bullet lists for commands, and backtick formatting for options — so bothhelpand--helppaths start from the same markdown source.2. Fix
CliHost.WriteRootFlagto render viaMarkdownRenderer.RenderToAnsiPass the markdown through
MarkdownRenderer.RenderToAnsiinstead of writing it directly withstdout.WriteLine.3. Fix
HelpCommand.RunAsyncto launch TUI markdown viewerUse
RunnableWrapper<Markdown, object?>to display the help content in a fullscreen Terminal.GuiMarkdownview, following the same pattern asInputCommandRunner.RenderCatAsyncalready correctly usesMarkdownRenderer.RenderToAnsi— no change needed there.4. Add tests
--helpproduces ANSI-rendered outputMetadataHelpProvidergenerates markdownhelp --catstill works correctlyNotes
helpcommand and--helpflag) will share the same markdown source