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

Counter incorrectly renders value in help #367

Closed
mattdowdell opened this issue Jul 18, 2023 · 2 comments · Fixed by #388
Closed

Counter incorrectly renders value in help #367

mattdowdell opened this issue Jul 18, 2023 · 2 comments · Fixed by #388

Comments

@mattdowdell
Copy link

I have a verbose flag defined something like:

type Cmd struct {
  Verbose int `type:"counter"`
}

According to the tests, the help for this command should render as:

  --verbose

But it actually renders as:

  --verbose=INT

After much digging, I tracked the issue down to here. This is where the flag is actually rendered in help, as opposed to Flag.String which actually appears to be wholly unused when building help.

Would it be possible to make the help omit the value and avoid users thinking they should specify the value for counters?

For the record, I'm using:

  • Kong: v0.8.0
  • Go v1.20.5
@dropwhile
Copy link
Contributor

dropwhile commented Nov 12, 2023

I'm having the same issue.

struct partial:

Version    int    `name:"version" short:"V" type:"counter" help:"Print version and exit; specify twice to show license information."`

rendered:

-V, --version=INT    Print version and exit; specify twice to show license information.
  • kong: v0.8.1
  • Go: 1.21.4

@dropwhile
Copy link
Contributor

dropwhile commented Nov 12, 2023

PR opened with possible fix.

The struct partial:

Version    int    `name:"version" short:"V" type:"counter" help:"Print version and exit; specify twice to show license information."`

now shows:

-V, --version    Print version and exit; specify twice to show license information.

dropwhile added a commit to dropwhile/kong that referenced this issue Nov 12, 2023
alecthomas pushed a commit that referenced this issue Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants