-
Notifications
You must be signed in to change notification settings - Fork 232
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
Document positional args in help text #43
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This also ensures backwards compatibility with `config validate`.
Since we require a PATH argument, the default is useless.
We're intentionally removing the enum values here as they will be documented separately from the `use` string.
Codecov Report
@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 39.17% 40.47% +1.29%
==========================================
Files 13 13
Lines 878 877 -1
==========================================
+ Hits 344 355 +11
+ Misses 510 498 -12
Partials 24 24
Continue to review full report at Codecov.
|
marcomorain
approved these changes
Aug 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using a combination of the default
UsageTemplate
from cobra, and a custom function which we've added to cobra template, we can create our own template which will display args in the help text for commands that have annotations (which are documented here as amap[string]string
).This PR was created on top of #40 in hopes that will be merged first, and we can preview it's changes on this branch. Once that PR is merged, we can rebase this one and it should merge cleanly into master.
Demo
Here's the help text for a command without args:
Here's the help text for a command with args: