Skip to content
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

fix: generate long desc and examples for root command #53

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Apr 12, 2024

We're already calling loadLongDescription recursively, no need to range over the subcommands, otherwise we're skipping the root command.

@dvdksn
Copy link
Contributor Author

dvdksn commented Apr 12, 2024

@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.

clidocstool.go Outdated Show resolved Hide resolved
@dvdksn dvdksn force-pushed the fix-root-command-desc-examples branch from ab5ac4f to adf75cb Compare April 18, 2024 06:57
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM

clidocstool_test.go Outdated Show resolved Hide resolved
@dvdksn dvdksn force-pushed the fix-root-command-desc-examples branch from fc01364 to 9712509 Compare April 23, 2024 13:37
fixtures/docker.md Show resolved Hide resolved
fixtures/docker.yaml Show resolved Hide resolved
@dvdksn dvdksn requested a review from thaJeztah May 27, 2024 13:49
@thaJeztah
Copy link
Member

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? #53 (comment)

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 🙈

@dvdksn
Copy link
Contributor Author

dvdksn commented May 29, 2024

@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.

0f4cffc#diff-9059958acfc03b30a2ff8fda8c5bb8403e63b17d7f32cdefe4611817db5cd191R57-R60

Plugin: true,
Plugin: false,
Copy link
Member

Choose a reason for hiding this comment

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

Why were these changes needed? (Just curious as I couldn't immediately associate with the change in this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dvdksn
Copy link
Contributor Author

dvdksn commented Jul 2, 2024

Let's merge this

Adds a hidden --help flag (like in docker/cli) and a dummy -H flag

Signed-off-by: David Karlsson <[email protected]>
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM

@dvdksn
Copy link
Contributor Author

dvdksn commented Jul 2, 2024

I've used this version to generate markdown here:

I've also generated yaml (for docker/cli) here: docker/docs@b9ca733

@crazy-max
Copy link
Member

Let's get this one in

@crazy-max crazy-max merged commit 8270ed3 into docker:main Jul 2, 2024
3 checks passed
@dvdksn dvdksn deleted the fix-root-command-desc-examples branch July 2, 2024 17:10
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.

4 participants