Fix formatDocPageAsMan() mislabeling untitled sections as OPTIONS#601
Fix formatDocPageAsMan() mislabeling untitled sections as OPTIONS#601
formatDocPageAsMan() mislabeling untitled sections as OPTIONS#601Conversation
`formatDocPageAsMan()` used `"OPTIONS"` as the fallback heading for untitled sections regardless of entry kinds. Now untitled sections containing only commands render as `COMMANDS`, and untitled sections containing only arguments render as `ARGUMENTS`. Close #261 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
@codex review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #601 +/- ##
==========================================
+ Coverage 94.87% 94.88% +0.01%
==========================================
Files 38 38
Lines 17160 17233 +73
Branches 4518 4528 +10
==========================================
+ Hits 16280 16352 +72
- Misses 868 869 +1
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis pull request fixes a bug in Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
formatDocPageAsMan()usedsection.title?.toUpperCase() ?? "OPTIONS"as the fallback heading for untitled sections, so sections containing only commands or only arguments were still labeled.SH OPTIONS. This patch adds aninferSectionTitle()helper in packages/man/src/man.ts that inspects entry kinds before choosing the fallback: untitled command-only sections now render asCOMMANDS, untitled argument-only sections render asARGUMENTS, and mixed or option-only sections keep the existingOPTIONSlabel.For example, a parser with two subcommands and no explicit section title previously produced:
After this fix, the same parser produces:
Fixes #261
Test plan