Trim flags to avoid mistakes due to empty lines or espaces...
This commit is contained in:
parent
e6d8f2db1b
commit
0cc72712a4
7 changed files with 24 additions and 14 deletions
|
|
@ -38,6 +38,7 @@ type ExerciceFlag struct {
|
|||
ShowLines bool `toml:",omitempty"`
|
||||
Ordered bool `toml:",omitempty"`
|
||||
CaseSensitive bool `toml:",omitempty"`
|
||||
NoTrim bool `toml:",omitempty"`
|
||||
ValidatorRe string `toml:"validator_regexp,omitempty"`
|
||||
Placeholder string `toml:",omitempty"`
|
||||
Help string `toml:",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, validatorRegexp(flag.ValidatorRe))
|
||||
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, flag.NoTrim, validatorRegexp(flag.ValidatorRe))
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: flag #%d: %s", path.Base(exercice.Path), flagline, err.Error()))
|
||||
return
|
||||
|
|
|
|||
Reference in a new issue