xor isn't supported with enum flags
- Langage dominant
- Go
- Étoiles
- 3.2k
- Forks
- 188
- Merge moyen
- 1 j 1 h
- PR mergées (30 j)
- 2
Description
I'd like to be able to xor two flags, where one flag is a string with lots of options and another flag is a bool. If the user uses the bool the enum flag should get assigned its default value.
IE this test should pass:
```go
func TestXorEnum(t *testing.T) {
var cli struct {
One string `xor:"a" default:"None" enum:"A,B,C,None"`
Two bool `xor:"a"`
}
p := mustNew(t, &cli)
_, err := p.Parse([]string{"--two"})
require.NoError(t, err)
require.Equal(t, "None", cli.One)
}
```
Today it fails
```
--- FAIL: TestXorEnum (0.00s)
kong_test.go:846:
Error Trace: kong_test.go:846
Error: Received unexpected error:
--one and --two can't be used together
Test: TestXorEnum
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.