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 manpage, the indentation of a command following a command with only hidden options is wrong. #269

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

Comments

@chipaca
Copy link
Contributor

chipaca commented Sep 22, 2018

If for some reason you have a command that has options, but all the options are hidden, then the command that appears after it in the manpage will be indented beyond where it should be.

As an example, given

package main

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

type options struct {
	A struct {
		Hidden bool `long:"hidden" hidden:"yes"`
	} `command:"a" description:"the a command as one hidden option"`
	Z struct{} `command:"z" description:"the z command gets indented wrong :-("`
}

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

as /tmp/bug.go, then running go run /tmp/bug.go | MANWIDTH=60 man -l - gives you

bug(1)            General Commands Manual           bug(1)

NAME
       bug -

SYNOPSIS
       bug [OPTIONS]

DESCRIPTION
OPTIONS
COMMANDS
   a
       the a command as one hidden option

       Usage: bug a [a-OPTIONS]

          z   the z command gets indented wrong :-(

                     22 September 2018              bug(1)
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