Do not skip groups that are commands when working out alignment#281
Open
chipaca wants to merge 1 commit intojessevdk:mainfrom
Open
Do not skip groups that are commands when working out alignment#281chipaca wants to merge 1 commit intojessevdk:mainfrom
chipaca wants to merge 1 commit intojessevdk:mainfrom
Conversation
Without this change, groups that are commands but that don't satisfy (*Group).showInHelp() would be skipped when working out the alignment, which would result in negative lengths when trying to process a group with only positional options. This fixes jessevdk#280.
Contributor
Author
|
I need to say: I'm not really sure this is the right fix. It still leaves the help looking weird in some combinations (like if you have a hidden command that is the one you're asking for help on). Nevertheless it fixes the issue, and I don't think it introduces more issues... |
chipaca
commented
Oct 10, 2018
| "No error": {value: nil, isHelp: false}, | ||
| "Plain error": {value: errors.New("an error"), isHelp: false}, | ||
| "ErrUnknown": {value: newError(ErrUnknown, "an error"), isHelp: false}, | ||
| "ErrHelp": {value: newError(ErrHelp, "an error"), isHelp: true}, |
Contributor
Author
There was a problem hiding this comment.
gah, my gofmt-on-save is forever doing this
|
if you just want to simply fix skipping the group, why not just change This is what I implemented on my fork here: https://github.com/sammiq/go-flags/pull/3 |
This file contains hidden or 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
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.
Without this change, groups that are commands but that don't satisfy
(*Group).showInHelp() would be skipped when working out the alignment,
which would result in negative lengths when trying to process a group
with only positional options.
This fixes #280.