XOR groups for flags. (#35)

This commit is contained in:
gak
2019-07-20 20:31:04 +10:00
committed by Alec Thomas
parent 0548c6b1af
commit f830198fcd
6 changed files with 59 additions and 0 deletions
+2
View File
@@ -27,6 +27,7 @@ type Tag struct {
Sep rune
Enum string
Group string
Xor string
Vars Vars
Prefix string // Optional prefix on anonymous structs. All sub-flags will have this prefix.
Embed bool
@@ -151,6 +152,7 @@ func parseTag(fv reflect.Value, ft reflect.StructField) *Tag {
t.Format = t.Get("format")
t.Sep, _ = t.GetRune("sep")
t.Group = t.Get("group")
t.Xor = t.Get("xor")
t.Prefix = t.Get("prefix")
t.Embed = t.Has("embed")
if t.Sep == 0 {