aboutsummaryrefslogtreecommitdiff
path: root/golangflag_test.go
AgeCommit message (Collapse)Author
2025-07-30add CopyToGoFlagSetPatrick Ohly
This is useful for programs which want to define some flags with pflag (for example, in external packages) but still need to use Go flag command line parsing to preserve backward compatibility with previous releases, in particular support for single-dash flags. Without this in pflag, such tools have to resort to copying via the public API, which leads to less useful help messages (type of basic values will be unknown).
2025-05-14fix #423 : Add helper function and some documentation to parse shorthand go ↵Andrea Tarocchi
test flags.
2018-04-03make x.Parsed() return true after AddGoFlagSet(x) and pflag.Parse() (#162)childe
* make GoFlagSets.Parsed() true after pflag.Parse some third part lib such as glog use go flag package, and its some actions depends on if goflag.Parsed(). * add test case for goflag.CommandLine.Parsed() * add comment to goflag.CommandLine.Parsed test case
2015-08-16Add functions to support golang flags in pflagsEric Paris
They aren't "perfect". spf13/pflag chose to use an explicit `Type` in the value. golang has nothing of the sort and has a rather crazy IsBoolFlag() bit of nonsense for the one case that really makes sense to have the explicit `Type`. Probably because adding interfaces really screws people up. So supporting golang flags in pflags isn't super super simple, we need to figure out how to handle our `Type` given only the information available in a golang flag. This does it as best we can with `reflect`.