sync: introducing showlines property for vectors

It allows players to know in advance how many items the vector is composed.
This commit is contained in:
nemunaire 2019-11-25 17:45:41 +01:00
parent a545112cb2
commit b4fa57f9c9
4 changed files with 35 additions and 9 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"path"
"strconv"
"strings"
"time"
)
@ -29,6 +30,7 @@ type myTeamFlag struct {
Label string `json:"label"`
Help string `json:"help,omitempty"`
Separator string `json:"separator,omitempty"`
NbLines uint64 `json:"nb_lines,omitempty"`
IgnoreOrder bool `json:"ignore_order,omitempty"`
IgnoreCase bool `json:"ignore_case,omitempty"`
ValidatorRe *string `json:"validator_regexp,omitempty"`
@ -205,10 +207,11 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
}
// Treat array flags
if k.Label[0] == '`' && len(k.Label) > 3 {
flag.Label = k.Label[3:]
if k.Label[0] == '`' && len(k.Label) > 4 {
flag.Label = k.Label[4:]
flag.Separator = string(k.Label[1])
flag.IgnoreOrder = k.Label[2] == 't'
flag.NbLines, _ = strconv.ParseUint(string(k.Label[3]), 10, 8)
} else {
flag.Label = k.Label
}