-
Notifications
You must be signed in to change notification settings - Fork 504
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
cmd: limit global flags displayed on cli help output #5077
Conversation
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. Just need to resolve the merge conflicts.
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.
The changes look great! The only thing I noticed is that horizon db reingest
displays all global flags, whereas horizon db reingest -h
does not. I believe horizon db reingest
cannot be used on its own without specifying a range so I expected the output of horizon db reingest
to same as horizon db reingest -h
good catch, yeah, I think cobra is routing through a 'usage' output function there, so the hooked 'help' didn't get a chance to run, I'll look into it further to see if can capture that path, thanks! |
@urvisavla , fortunately, cobra allowed overriding the usage output in same way as help output, so i was able to apply the same global flags behavior in this case of usage - deca1cc |
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
-h
cli output to when it's only relevant to the command's general roles that it may be performing 'ingestion', 'db update tool' or 'api server'.Why
The global flags are a fixed set of parameters and get displayed as a single large block on the console help output for any help request regardless of the level of
horizon
command. Since it's a fixed list, many of the global parameters tend to not be relevant to the context of command being requested by help and therefore can be somewhat mis-leading.Closes #5022
Notes for review:
Start here, the solution overrides the cobra HelpFunc:
https://github.com/stellar/go/pull/5077/files#diff-7ad09d8c6e6a91967287e26e0343f0262ed02aa9fab85a0741cf665eeab514efR52
Some screen shots of help output from this PR on top, and current horizon on bottom.
`stellar-horizon -h`.
`stellar-horizon ingest -h`.
Screen shot of help output from this PR on left, and current horizon on right:
stellar-horizon db reingest range -h
.