Skip to content
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

Consul CLI commands don't display detailed help #3536

Closed
slackpad opened this issue Oct 5, 2017 · 3 comments · Fixed by #3541
Closed

Consul CLI commands don't display detailed help #3536

slackpad opened this issue Oct 5, 2017 · 3 comments · Fixed by #3541
Assignees
Labels
theme/cli Flags and documentation for the CLI interface type/bug Feature does not function as expected
Milestone

Comments

@slackpad
Copy link
Contributor

slackpad commented Oct 5, 2017

Running any of the Consul CLI commands with -help or -h only displays the summary of the command, not any of the detailed help for the options, which is expected.

@slackpad slackpad added type/bug Feature does not function as expected theme/cli Flags and documentation for the CLI interface labels Oct 5, 2017
@slackpad slackpad added this to the 1.0 milestone Oct 5, 2017
@magiconair magiconair assigned magiconair and unassigned preetapan Oct 5, 2017
@magiconair
Copy link
Contributor

magiconair commented Oct 5, 2017

I've monkey patched mitchellh/cli in May with c068066 to work around this issue before and this patch got clobbered by 006099b. Since we have refactored the config handling I can address this properly now.

@magiconair
Copy link
Contributor

The main reason this breaks is that the mitchellh/cli library has changed its behavior some time ago to support consul agent -h instead of consul -h agent. The consequence of that change is that the Run() method is no longer called to populate the flag set before generating the help output. It only calls Help(). If the Help() method does not populate the flag set then no help for flags will be written.

To fix this without monkey patching the cli lib again we have to refactor all commands and move the flag initialization into a separate method which is then called from both Run() and Help().

magiconair added a commit that referenced this issue Oct 5, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 5, 2017
This patch backports a fix which will show the correct usage screen for
command line flags.

This is considered a temporary fix until the code has been refactored.
Newer versions of the cli library require that the flag set is populated
when Help() is called or that it is populated within Help() itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 5, 2017
This patch backports a fix which will show the correct usage screen for
command line flags.

This is considered a temporary fix until the code has been refactored.
Newer versions of the cli library require that the flag set is populated
when Help() is called or that it is populated within Help() itself.

Fixes #3536
@magiconair
Copy link
Contributor

We have chosen to first backport the fix we had before and work on a better implementation after the 1.0 release. #3538 will be a basis for this but not the final implementation.

magiconair added a commit that referenced this issue Oct 6, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 11, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
preetapan pushed a commit that referenced this issue Oct 11, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 17, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 17, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
magiconair added a commit that referenced this issue Oct 17, 2017
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/cli Flags and documentation for the CLI interface type/bug Feature does not function as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants