Skip to content

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

Merged
crazy-max merged 3 commits into
docker:mainfrom
dvdksn:fix-root-command-desc-examples
Jul 2, 2024
Merged

fix: generate long desc and examples for root command#53
crazy-max merged 3 commits into
docker:mainfrom
dvdksn:fix-root-command-desc-examples

Conversation

@dvdksn

Copy link
Copy Markdown
Contributor

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

@dvdksn

Copy link
Copy Markdown
ContributorAuthor

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

Comment threadclidocstool.go
@dvdksn
dvdksnforce-pushed the fix-root-command-desc-examples branch from ab5ac4f to adf75cbCompareApril 18, 2024 06:57
@codecov-commenter

codecov-commenter commented Apr 18, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
clidocstool.go72.22%2 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@crazy-maxcrazy-max left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment threadclidocstool_test.go Outdated
@dvdksn
dvdksnforce-pushed the fix-root-command-desc-examples branch from fc01364 to 9712509CompareApril 23, 2024 13:37
Comment threadfixtures/docker.md
Comment threadfixtures/docker.yaml
@dvdksn
dvdksn requested a review from thaJeztahMay 27, 2024 13:49
@thaJeztah

Copy link
Copy Markdown
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

dvdksn commented May 29, 2024

Copy link
Copy Markdown
ContributorAuthor

@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

Root: dockerCmd,
SourceDir: tmpdir,
Plugin: true,
Plugin: false,

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@dvdksn
dvdksn requested review from crazy-max and thaJeztahJuly 2, 2024 12:53
@dvdksn

Copy link
Copy Markdown
ContributorAuthor

Let's merge this

dvdksn added 3 commits July 2, 2024 15:03
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Adds a hidden --help flag (like in docker/cli) and a dummy -H flag
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn
dvdksnforce-pushed the fix-root-command-desc-examples branch from 0f4cffc to 7d56538CompareJuly 2, 2024 13:03

@crazy-maxcrazy-max left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dvdksn

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

Let's get this one in

@crazy-max
crazy-max merged commit 8270ed3 into docker:mainJul 2, 2024
@dvdksn
dvdksn deleted the fix-root-command-desc-examples branch July 2, 2024 17:10
Sign up for freeto 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

@dvdksn@codecov-commenter@thaJeztah@crazy-max