pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Results 112 pflag issues
Sort by recently updated
recently updated
newest added

https://go.dev/doc/go1.19 > The new function [TextVar](https://go.dev/pkg/flag/#TextVar) defines a flag with a value implementing [encoding.TextUnmarshaler](https://go.dev/pkg/encoding/#TextUnmarshaler), allowing command-line flag variables to have types such as [big.Int](https://go.dev/pkg/math/big/#Int), [netip.Addr](https://go.dev/pkg/net/netip/#Addr), and [time.Time](https://go.dev/pkg/time/#Time). - https://pkg.go.dev/flag#TextVar

# Motivation [Issue 352](https://github.com/spf13/pflag/issues/352) reported by @wimglenn # Changes Remove redundant error print function call in `failf`. # Summary This deletes the extra error log which gets printed when opted...

Since Go maps have randomized iteration order, `FlagUsages()` returns inconsistent output: [playground](https://go.dev/play/p/NYW3Gr3c6ic) ```go // You can edit this code! // Click here and start typing. package main import ( "fmt"...

This adds the ability to remove a Flag from a FlagSet, e.g. `flagSet.RemoveFlag("my-flag")` My end-goal is to allow cobra commands to opt-out of PersistentFlags() that they inherit. Please LMK if...

A proposal for improving the readability of unit tests, indulding into 1 test dependency.

When the program below is run with `go run ./main.go --sts 'key="495"'` I get `map[string]string{"key":"\"123"}`, where only one double quote has been trimmed from the value. I don't see anything...

I have a use-case where I need to perform validation on flag values. In other words, I need to check that the value passed in by the user belongs to...

The `SortFlags` option mentioned in the README is not actually exported. https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/README.md?plain=1#L257 Instead `CommandLine.SortFlags` is available. ```diff # README.md flags.BoolP("verbose", "v", false, "verbose output") flags.String("coolflag", "yeaah", "it's really cool flag")...

When setting a count flag, the default value setting is not supported -- `FlagSet.CountVarP()` or `FlagSet.CountVar()` only takes `name` and `usage` as parameters. Weirdly, it is noted in the comment...

chore: full relinting * enabled linting check in CI (github action) * contributes #385 * requires #248 Signed-off-by: Frederic BIDON