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

Support unicode chars in WriteHelp #401

Open
JasonMing opened this issue Jan 16, 2024 · 0 comments
Open

Support unicode chars in WriteHelp #401

JasonMing opened this issue Jan 16, 2024 · 0 comments

Comments

@JasonMing
Copy link

WriteHelp function will auto wrap and align the description that longer than terminal's width.
When multi-byte character in the description, like emoji or Chinese, the wrapping will be wrong.

func main() {
	var opt struct {
		WorkerId uint64 `short:"w" long:"worker" description:"01234567891123456789212345678931234567894123456789512345678961❤3456789"`
	}

	p := flags.NewParser(&opt, flags.HelpFlag|flags.PrintErrors)
	p.WriteHelp(os.Stdout)
}

Output:

Usage:
  example [OPTIONS]

Application Options:
  -w, --worker= 01234567891123456789212345678931234567894123456789512345678961�-

                ��3456789
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

1 participant