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

sub command options are printed in single line in help text #1514

Closed
evgnomon opened this issue Oct 4, 2022 · 2 comments
Closed

sub command options are printed in single line in help text #1514

evgnomon opened this issue Oct 4, 2022 · 2 comments
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this

Comments

@evgnomon
Copy link

evgnomon commented Oct 4, 2022

My urfave/cli version is

2.17.1

Checklist

  • My project is using go modules.
  • My project is automatically downloading the latest version.

Describe the bug

Here is the printed text for option helps:
https://go.dev/play/p/US17m1KeEib

--itemNo value, -i value  option 1--output value, -o value  option 2 (default: no write to file)

While it should be in multiple lines i.e.

--itemNo value, -i value  option 1
--output value, -o value  option 2 (default: no write to file)

To reproduce

https://go.dev/play/p/US17m1KeEib

package main

import (
	"log"

	"github.com/urfave/cli/v2"
)

func main() {
	app := &cli.App{
		Name: "protodump",
		Commands: []*cli.Command{
			{
				Name: "message",

				Aliases: []string{"msg"},

				Subcommands: []*cli.Command{
					{
						Name: "subcomm",

						Flags: []cli.Flag{
							&cli.StringFlag{
								Name:     "itemNo",
								Required: true,
								Aliases:  []string{"i"},
								Usage:    "option 1",
							},
							&cli.StringFlag{
								Name:        "output",
								Aliases:     []string{"o"},
								DefaultText: "no write to file",
								Usage:       "option 2",
							},
						},
						Action: func(c *cli.Context) error {
							return nil
						},
					},
				},
			},
		},
	}

	err := app.Run([]string{"app", "msg", "subcomm", "--help"})
	if err != nil {
		log.Fatal(err)
	}
}

Observed behavior

options printed in a single line for help text. This issue is not happening in all platforms. We have seen in in Windows and The playground but not in macOS.

Expected behavior

Print option help in separate lines.

$ go version
go version go1.18.6 linux/amd64
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dagre3/.cache/go-build"
GOENV="/home/dagre3/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/dagre3/go/pkg/mod"
GONOPROXY="git.build.ingka.ikea.com/*,github.com/ingka-group-digital/*"
GONOSUMDB="git.build.ingka.ikea.com/*,github.com/ingka-group-digital/*"
GOOS="linux"
GOPATH="/home/dagre3/go"
GOPRIVATE="git.build.ingka.ikea.com/*,github.com/ingka-group-digital/*"
GOPROXY="https://proxy.golang.org/,direct"
GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go@1.18/1.18.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go@1.18/1.18.6/libexec/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.6"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc-11"
CXX="g++-11"
CGO_ENABLED="1"
GOMOD="/home/dagre3/git/ingka-group-digital/rrm-sr-salesitem-api/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build690370080=/tmp/go-build -gno-record-gcc-switches"
@evgnomon evgnomon added area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this labels Oct 4, 2022
@evgnomon evgnomon changed the title your bug title goes here sub command options are printed in single line Oct 4, 2022
@evgnomon evgnomon changed the title sub command options are printed in single line sub command options are printed in single line in help text Oct 4, 2022
aimichal added a commit to aimichal/cli that referenced this issue Oct 4, 2022
@dearchap
Copy link
Contributor

dearchap commented Oct 6, 2022

Duplicate of #1505 . Please see PR #1506 for the fix

@aimichal
Copy link

aimichal commented Oct 7, 2022

This is fixed for me in the main branch: #1515 (comment) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants