-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add '[args]' and 'Valid Args:' to --help #842
Draft
umarcor
wants to merge
7
commits into
spf13:main
Choose a base branch
from
umarcor:feat-validinhelp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
ba7e68a
to
f610cf0
Compare
f610cf0
to
fec0a0b
Compare
07aaab8
to
56cb7bb
Compare
2198c8d
to
f87f62a
Compare
d8d87f2
to
b363e55
Compare
b363e55
to
674b220
Compare
zwpaper
reviewed
Jan 4, 2020
6b60c76
to
145ff21
Compare
d359f25
to
a403deb
Compare
31007ba
to
3e25070
Compare
d4e6320
to
04b13c1
Compare
f3fd262
to
86e690d
Compare
86e690d
to
d2d0de4
Compare
This PR is not stale, but blocked by #841. Please, remove the |
d2d0de4
to
772473b
Compare
a4a3b1c
to
7684682
Compare
d51b602
to
d7a7e6d
Compare
d7a7e6d
to
90bd440
Compare
90bd440
to
8825c7b
Compare
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
lifecycle/frozen
Prevents GitHub actions from labeling issues / PRs with stale and rotten
size/XL
Denotes a PR that exceeds 200 lines. Caution!
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.
Close #571 and Close #576.
This PR is based on #841, and it must be merged after that. See difference: umarcor/cobra@feat-matchvalid...umarcor:feat-validinhelp
The added feature is to modify the output of
Usage()
to print[args]
if the command accepts args:app [args]
andapp [flags] [args]
are not shown at the same time.[args]
is only added if the command is runnable, andArgs != NoArgs
, orArgs == nil && (!c.HasAvailableSubCommands() || c.HasParent())
, etc.Valid Args
is only shown ifValidArgs
is not empty and[args]
is shown.To Do
MinimumNArgs
,ExactArgs
orRangeArgs
are used,args
should be shown instead of[args]
.Usage()
should show the constraints applied to the args (NArgs>x
,NArgs<x
,NArgs=x
orx<NArgs<y
).These have not been implemented yet, because I don't know any easy mechanism to detect the type of
c.Args
.