fix: generate long desc and examples for root command
We're already calling loadLongDescription recursively, no need to range over the subcommands, otherwise we're skipping the root command.
@crazy-max can you help me look at these test failures? I have tried generating docs with this version in both cli and buildx and I don't see any issues. I can't quite figure out what's going wrong in these tests either.
Codecov Report
Attention: Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
Project coverage is 69.71%. Comparing base (
c6cc9a5) to head (7d56538).
| Files | Patch % | Lines |
|---|---|---|
| clidocstool.go | 72.22% | 2 Missing and 3 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #53 +/- ##
==========================================
- Coverage 70.58% 69.71% -0.88%
==========================================
Files 5 5
Lines 459 459
==========================================
- Hits 324 320 -4
Misses 77 77
- Partials 58 62 +4
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Sorry, I realise my question about --help somewhat distracted from the main issue; does this currently produce documentation for options/flags that are defined on the command? https://github.com/docker/cli-docs-tool/pull/53#discussion_r1576284060
I recall now I went looking for flags, and noticing the --help as example, but currently there's no flags in the produced output (but probably because none are defined). If we want to use this for the root command, we probably need to make sure that it includes flags 🙈
@thaJeztah Aaah, I see now yes. Good callout. I just pushed a commit that adds two flags:
--help(hidden, persistent flag)-H(dummy flag)
I looked at the options implementation in docker/cli and turns out adding --help as a hidden flag also removes it from the man fixtures (for subcommands as well, since it's a persistent flag), and interestingly, adds it for yaml fixtures (but as a hidden object 😆).
I think this change is appropriate since it mimics what we do in the core CLI.
https://github.com/docker/cli-docs-tool/pull/53/commits/0f4cffc674c9bfcef40067bf37d5c895459ae406#diff-9059958acfc03b30a2ff8fda8c5bb8403e63b17d7f32cdefe4611817db5cd191R57-R60
Let's merge this
I've used this version to generate markdown here:
- docker/cli: https://github.com/docker/cli/pull/5010/commits/719f88ea6c09c4ab8d8c9974940e631dd55012a0
- docker/buildx: https://github.com/docker/buildx/pull/2565
I've also generated yaml (for docker/cli) here: https://github.com/docker/docs/pull/19794/commits/b9ca7336debd9e56e61a59d59ea51b74c8ac5760
Let's get this one in