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

flag: better support for multi-line help messages #20799

Closed
chmike opened this issue Jun 26, 2017 · 2 comments
Closed

flag: better support for multi-line help messages #20799

chmike opened this issue Jun 26, 2017 · 2 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@chmike
Copy link

chmike commented Jun 26, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.8.3

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

What did you do?

myParam1 := flag.Int("param1", 0, "parameter 1 line 1\nparameter 1 line2")
myParam2 := flag.Int("param2", 0, "parameter 2")

What did you expect to see?

Usage of xxx:
   -param1 int
    	parameter 1 line 1
        parameter 1 line 2
   -param2 int
    	parameter 2

What did you see instead?

Usage of xxx:
   -param1 int
    	parameter 1 line 1
parameter 1 line 2
   -param2 int
    	parameter 2
@mvdan mvdan changed the title request: multi line flag help message flag: better support for multi-line help messages Jun 26, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 26, 2017
@bradfitz bradfitz added this to the Go1.10 milestone Jun 26, 2017
@rsc
Copy link
Contributor

rsc commented Jun 26, 2017

/cc @robpike

We already do something similar for testing.T.Logf and friends. Maybe it would be OK to do here too.

@gopherbot
Copy link

Change https://golang.org/cl/66711 mentions this issue: flag: align multi-line usage strings

victpork added a commit to victpork/pflag that referenced this issue Feb 4, 2018
With reference to golang/go#20799, pflag now will respect newline in usage string and do wrap accordingly. Also add test cases for testing
eparis pushed a commit to spf13/pflag that referenced this issue Mar 28, 2018
* Add multiline wrapping support

With reference to golang/go#20799, pflag now will respect newline in usage string and do wrap accordingly. Also add test cases for testing

* Break at \n only if \n pos<wrap
@golang golang locked and limited conversation to collaborators Sep 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants