-
Notifications
You must be signed in to change notification settings - Fork 12
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
Improve boolean flag documentation generation #48
Improve boolean flag documentation generation #48
Conversation
@thaJeztah Let me know if we want to also display the Type of boolean flags regardless of their default value |
I think we want the same for yaml generation? |
Can we also have a test for this case? |
@crazy-max I think we already unconditionally set the default value for YAML; at least looking at the fixture here, I see cli-docs-tool/fixtures/docker_buildx_build.yaml Lines 74 to 78 in f588677
|
Ah ok looks good then 👍 |
That's correct! Do we want to make any changes here? cli-docs-tool/clidocstool_yaml.go Lines 271 to 290 in f588677
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
we should probably look at some additional test-cases in a follow-up
} else if f.DefValue != "" && (f.Value.Type() != "bool" && f.DefValue != "true") && f.DefValue != "[]" { | ||
} else if f.DefValue != "" && ((f.Value.Type() != "bool" && f.DefValue != "true") || (f.Value.Type() == "bool" && f.DefValue == "true")) && f.DefValue != "[]" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a follow-up, we should probably look at splitting some of these up. Things start to become too complicated IMO (too many boolean conditions here, which makes it easy to introduce bugs).
@crazy-max LGTY? |
Can we have a test in https://github.com/docker/cli-docs-tool/blob/main/clidocstool_test.go#L38? Just a dummy new flag like |
Update the documentation generation logic to include values in Type and Default columns for boolean flags that have true as a default value. This change addresses the need for users to differentiate between boolean flags that require explicit negation. Signed-off-by: George Margaritis <gmargaritis@protonmail.com>
4c6e97f
to
e795250
Compare
@crazy-max Added the test case, we should be good to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
Resolves #47
Updated the documentation generation logic to include values in Type and Default columns for boolean flags that have true as a default value. This change addresses the need for users to differentiate between boolean flags that require explicit negation.