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

In the generated help, hidden options are still counted for alignment #270

Closed
chipaca opened this issue Sep 22, 2018 · 0 comments
Closed

Comments

@chipaca
Copy link
Contributor

chipaca commented Sep 22, 2018

Given

package main

import "os"
import "github.com/jessevdk/go-flags"

type options struct {
	A bool `short:"a" description:"output should be aligned"`
	M bool `long:"a-very-long-option-name" description:"cue 'long long man' song" hidden:"yes"`
	Z bool `short:"z" description:"operator is asleep"`
}

func main() { flags.NewParser(&options{}, 0).WriteHelp(os.Stdout) }

you get

Usage:
  bug2

Application Options:
  ‐a                             output should be aligned
  ‐z                             operator is asleep

chipaca added a commit to chipaca/go-flags that referenced this issue Sep 22, 2018
It changes the definition of `(*Option).canCli()` to also check
whether an option is hidden.

There's still some work to be done in this area as a group with no
non-hidden options will also not render right, but I'll get to that
later.
jessevdk added a commit that referenced this issue Sep 23, 2018
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

No branches or pull requests

2 participants