Implement sort_regexp_validator_groups
This commit is contained in:
parent
081ad1f928
commit
5a79343af8
7 changed files with 42 additions and 26 deletions
|
|
@ -40,6 +40,7 @@ type ExerciceFlag struct {
|
|||
CaseSensitive bool `toml:",omitempty"`
|
||||
NoTrim bool `toml:",omitempty"`
|
||||
ValidatorRe string `toml:"validator_regexp,omitempty"`
|
||||
SortReGroups bool `toml:"sort_validator_regexp_groups,omitempty"`
|
||||
Placeholder string `toml:",omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
ChoicesCost int64 `toml:"choices_cost,omitempty"`
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
|
|||
errs = append(errs, fmt.Sprintf("%q: WARNING flag #%d: non-printable characters in flag, is this really expected?", path.Base(exercice.Path), flagline))
|
||||
}
|
||||
|
||||
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, flag.NoTrim, validatorRegexp(flag.ValidatorRe))
|
||||
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, flag.NoTrim, validatorRegexp(flag.ValidatorRe), flag.SortReGroups)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: flag #%d: %s", path.Base(exercice.Path), flagline, err.Error()))
|
||||
return
|
||||
|
|
@ -140,6 +140,7 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
|
|||
IgnoreCase: !flag.CaseSensitive,
|
||||
Multiline: flag.Type == "text",
|
||||
ValidatorRegexp: validatorRegexp(flag.ValidatorRe),
|
||||
SortReGroups: flag.SortReGroups,
|
||||
Checksum: hashedFlag[:],
|
||||
ChoicesCost: flag.ChoicesCost,
|
||||
})
|
||||
|
|
|
|||
Reference in a new issue