Skip to content

feat: help TUI viewer, markdown rendering, rename ExampleApp to greet#7

Merged
tig merged 7 commits into
developfrom
tig/help-tui-viewer-and-rename-example-app
May 24, 2026
Merged

feat: help TUI viewer, markdown rendering, rename ExampleApp to greet#7
tig merged 7 commits into
developfrom
tig/help-tui-viewer-and-rename-example-app

Conversation

@tig
Copy link
Copy Markdown
Member

@tig tig commented May 24, 2026

Summary

Addresses #5 — the help command and --help flag now render markdown properly.

Help rendering fixes

  • HelpCommand.RunAsync launches a fullscreen TUI Markdown viewer (using Runnable + Markdown view + StatusBar with Quit shortcut), matching clet's HelpClet pattern
  • MetadataHelpProvider.GetRootHelp now emits markdown (tables + headers) instead of plain text
  • CliHost.WriteRootFlag passes --help output through MarkdownRenderer.RenderToAnsi for ANSI-styled stdout

Example app rename

  • Renamed examples/Terminal.Gui.Cli.ExampleAppexamples/greet
  • AssemblyName=greet, updated namespaces, solution file, CLAUDE.md, agent-guide resource
  • Added README.md with usage examples

Visual UI tests

  • Added CommandUiHarness (ported from clet's CletUiHarness) for in-process TUI rendering with golden-file assertions
  • 5 integration tests proving help renders correctly (ANSI snapshot, text content, subcommand help, golden comparison)
  • Set UPDATE_SNAPSHOTS=1 to regenerate golden files

Test summary

  • 17 unit tests ✅
  • 5 integration tests ✅ (including golden-file visual test)

Closes #5

- HelpCommand.RunAsync launches a TUI Markdown viewer (Runnable +
  Markdown + StatusBar) matching clet's pattern, instead of returning
  raw text in CommandResult
- MetadataHelpProvider.GetRootHelp emits markdown (tables, headers)
  instead of plain text
- CliHost.WriteRootFlag passes --help output through
  MarkdownRenderer.RenderToAnsi for ANSI-styled stdout
- Rename examples/Terminal.Gui.Cli.ExampleApp to examples/greet
  with AssemblyName=greet
- Add README.md for the greet example app
- Add visual UI tests (CommandUiHarness + golden-file assertions)
  ported from clet's CletUiHarness pattern
- Add MetadataHelpProviderTests and CliHost help rendering tests

Closes #5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ab8f359a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Terminal.Gui.Cli/MetadataHelpProvider.cs Outdated
tig and others added 6 commits May 24, 2026 16:19
- Port clet's MarkdownHelpRenderer approach: set Console.OutputEncoding to
  UTF-8 before rendering, use a full TG ANSI driver with proper layout/draw
  cycle, and restore encoding afterward. Fixes garbled box-drawing chars.
- Add FarewellCommand with --until option for navigation testing
- Add embedded markdown help files (help.md, greet.md, farewell.md, info.md)
- Configure EmbeddedMarkdownHelpProvider in greet example
- Fix InfoCommand to properly launch TUI viewer (was returning text without
  calling app.RunAsync, causing terminal to hang until Enter pressed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… args

- Add DefaultCommand option to CliHostOptions so bare args/options are
  retried as the default command (e.g. 'greet World' == 'greet greet World')
- Refactor CliHost.RunAsync into DispatchCommandAsync/ExecuteCommandAsync
- Add help:topic link navigation in HelpCommand via Markdown.LinkClicked
- Add 'Back to main help' links in all sub-topic help files
- Add help:command anchors in root help.md for topic navigation
- Make GreetCommand and FarewellCommand accept positional args for name
- Set greet example DefaultCommand = 'greet'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add BrowseBar (ported from clet) with back/forward history stacks,
  Ctrl+Left/Right shortcuts, and proper statusbar styling
- Rewrite HelpCommand.RunAsync to match clet's HelpClet pattern:
  BrowseBar, LinkClicked handler, NavigateTo, viewport reset
- Add TextMateSyntaxHighlighter for code block coloring
- Add horizontal scrollbar to markdown view
- Update golden file for new status bar layout

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- HelpBrowserUiTests: proves BrowseBar back/forward arrows render,
  embedded help content displays, subcommand view shows options,
  and golden file assertion for the browser layout
- GreetExampleTests: proves every documented example in the help files
  actually works (greet World, --formal Alice, farewell Bob,
  farewell --until tomorrow Bob, default command dispatch, etc.)
- Add embedded help.md resource to integration test assembly
- Total: 24 integration tests, 17 unit tests (41 total, all passing)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pipe characters and newlines in command/option descriptions would break
the generated markdown table structure. Add EscapeCell helper that
replaces | with \| and collapses newlines to spaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ReSharper cannot infer target type for 'new' inside collection expressions,
so use explicit 'new CommandOptionDescriptor(...)' instead of 'new (...)'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig tig merged commit d54b075 into develop May 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

help command and --help flag should render markdown like clet

1 participant