sync: use Separator attribute
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2020-12-11 21:03:12 +01:00
parent f53a5dbcf9
commit 8e8fa7c61c

View File

@ -33,9 +33,7 @@ func validatorRegexp(vre string) (validator_regexp *string) {
return return
} }
func getRawKey(input interface{}, validatorRe string, ordered bool, showLines bool) (raw string, prep string, errs []string) { func getRawKey(input interface{}, validatorRe string, ordered bool, showLines bool, separator string) (raw string, prep string, errs []string) {
separator := ","
// Concatenate array // Concatenate array
if f, ok := input.([]interface{}); ok { if f, ok := input.([]interface{}); ok {
if len(validatorRe) > 0 { if len(validatorRe) > 0 {
@ -108,7 +106,7 @@ func buildKeyFlag(exercice fic.Exercice, flag ExerciceFlag, flagline int, defaul
errs = append(errs, fmt.Sprintf("%q: flag #%d: Label should not end with punct (%q). Reword your label as a description of the expected flag, `:` are automatically appended.", path.Base(exercice.Path), flagline, flag.Label[len(flag.Label)-1])) errs = append(errs, fmt.Sprintf("%q: flag #%d: Label should not end with punct (%q). Reword your label as a description of the expected flag, `:` are automatically appended.", path.Base(exercice.Path), flagline, flag.Label[len(flag.Label)-1]))
} }
raw, prep, terrs := getRawKey(flag.Raw, flag.ValidatorRe, flag.Ordered, flag.ShowLines) raw, prep, terrs := getRawKey(flag.Raw, flag.ValidatorRe, flag.Ordered, flag.ShowLines, flag.Separator)
if len(terrs) > 0 { if len(terrs) > 0 {
for _, err := range terrs { for _, err := range terrs {
@ -151,7 +149,7 @@ func buildKeyFlag(exercice fic.Exercice, flag ExerciceFlag, flagline int, defaul
} }
for _, choice := range flag.Choice { for _, choice := range flag.Choice {
val, prep, terrs := getRawKey(choice.Value, "", false, false) val, prep, terrs := getRawKey(choice.Value, "", false, false, "")
if len(terrs) > 0 { if len(terrs) > 0 {
for _, err := range terrs { for _, err := range terrs {
errs = append(errs, fmt.Sprintf("%q: flag #%d: %s", path.Base(exercice.Path), flagline, err)) errs = append(errs, fmt.Sprintf("%q: flag #%d: %s", path.Base(exercice.Path), flagline, err))