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

SortFlags not exported #382

Open
plungingChode opened this issue Jul 12, 2023 · 1 comment
Open

SortFlags not exported #382

plungingChode opened this issue Jul 12, 2023 · 1 comment

Comments

@plungingChode
Copy link

The SortFlags option mentioned in the README is not actually exported.

pflag/README.md

Line 257 in d5e0c06

flags.SortFlags = false

Instead CommandLine.SortFlags is available.

# README.md
flags.BoolP("verbose", "v", false, "verbose output")
flags.String("coolflag", "yeaah", "it's really cool flag")
flags.Int("usefulflag", 777, "sometimes it's very useful")
-flags.SortFlags = false
+flags.CommandLine.SortFlags = false
flags.PrintDefaults()
@fredbi
Copy link
Collaborator

fredbi commented Oct 3, 2023

The example code should be completed regarding how the "flags" variable is created.

The FlagSet.SortFlags field is indeed exported. CommandLine is a convenient FlagSet exposed by the package.

Documentation bug, I'd say.

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