-
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
umarcor
force-pushed
the
feat-validinhelp
branch
6 times, most recently
from
March 20, 2019 23:46
ba7e68a
to
f610cf0
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
March 21, 2019 00:25
f610cf0
to
fec0a0b
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
July 11, 2019 19:51
07aaab8
to
56cb7bb
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
6 times, most recently
from
September 5, 2019 09:51
2198c8d
to
f87f62a
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
2 times, most recently
from
September 17, 2019 16:35
d8d87f2
to
b363e55
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
October 14, 2019 12:25
b363e55
to
674b220
Compare
zwpaper
reviewed
Jan 4, 2020
umarcor
force-pushed
the
feat-validinhelp
branch
3 times, most recently
from
January 6, 2020 22:38
6b60c76
to
145ff21
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
November 4, 2021 00:28
d359f25
to
a403deb
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
2 times, most recently
from
November 16, 2021 22:39
31007ba
to
3e25070
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
2 times, most recently
from
December 14, 2021 19:27
d4e6320
to
04b13c1
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
3 times, most recently
from
February 18, 2022 05:06
f3fd262
to
86e690d
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
February 24, 2022 20:15
86e690d
to
d2d0de4
Compare
This PR is not stale, but blocked by #841. Please, remove the |
umarcor
force-pushed
the
feat-validinhelp
branch
from
March 3, 2022 08:43
d2d0de4
to
772473b
Compare
marckhouzam
added
lifecycle/frozen
Prevents GitHub actions from labeling issues / PRs with stale and rotten
and removed
kind/stale
labels
Mar 3, 2022
umarcor
force-pushed
the
feat-validinhelp
branch
2 times, most recently
from
March 17, 2022 10:31
a4a3b1c
to
7684682
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
2 times, most recently
from
March 22, 2022 18:40
d51b602
to
d7a7e6d
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
March 25, 2022 19:34
d7a7e6d
to
90bd440
Compare
umarcor
force-pushed
the
feat-validinhelp
branch
from
August 21, 2022 22:18
90bd440
to
8825c7b
Compare
github-actions
bot
added
the
size/XL
Denotes a PR that exceeds 200 lines. Caution!
label
Aug 21, 2022
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
.