implement choices_cost

This commit is contained in:
nemunaire 2018-12-02 23:18:32 +01:00
parent f9abdd23c6
commit 476f0f553c
18 changed files with 180 additions and 24 deletions

View file

@ -270,6 +270,7 @@ type uploadedFlag struct {
ValidatorRe *string `json:"validator_regexp"`
Flag string
Value []byte
ChoicesCost int64
}
func createExerciceFlag(exercice fic.Exercice, body []byte) (interface{}, error) {
@ -287,7 +288,7 @@ func createExerciceFlag(exercice fic.Exercice, body []byte) (interface{}, error)
vre = uk.ValidatorRe
}
return exercice.AddRawFlag(uk.Label, uk.Help, uk.IgnoreCase, vre, []byte(uk.Flag))
return exercice.AddRawFlag(uk.Label, uk.Help, uk.IgnoreCase, vre, []byte(uk.Flag), uk.ChoicesCost)
}
func showExerciceFlag(flag fic.Flag, _ fic.Exercice, body []byte) (interface{}, error) {
@ -309,6 +310,7 @@ func updateExerciceFlag(flag fic.Flag, exercice fic.Exercice, body []byte) (inte
flag.Help = uk.Help
flag.IgnoreCase = uk.IgnoreCase
flag.Checksum = uk.Value
flag.ChoicesCost = uk.ChoicesCost
if uk.ValidatorRe != nil && len(*uk.ValidatorRe) > 0 {
flag.ValidatorRegexp = uk.ValidatorRe