Array flags can be non-ordered

This commit is contained in:
nemunaire 2018-12-04 19:09:58 +01:00
commit 0e36a850cf
5 changed files with 22 additions and 5 deletions

View file

@ -40,6 +40,7 @@ type myTeamFlag struct {
Label string `json:"label"`
Help string `json:"help,omitempty"`
Separator string `json:"separator,omitempty"`
IgnoreOrder bool `json:"ignore_order,omitempty"`
Solved *time.Time `json:"found,omitempty"`
Soluce string `json:"soluce,omitempty"`
Choices map[string]string `json:"choices,omitempty"`
@ -195,9 +196,10 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
flag.Solved = t.HasPartiallySolved(k)
}
if k.Label[0] == '`' && len(k.Label) > 2 {
flag.Label = k.Label[2:]
if k.Label[0] == '`' && len(k.Label) > 3 {
flag.Label = k.Label[3:]
flag.Separator = string(k.Label[1])
flag.IgnoreOrder = k.Label[2] == 't'
} else {
flag.Label = k.Label
}