Rename Exercice's Keys as Flags

This commit is contained in:
nemunaire 2018-09-24 10:00:17 +02:00 committed by Pierre-Olivier Mercier
parent f36e1c4e4d
commit d21f3b0b83
18 changed files with 252 additions and 252 deletions

View file

@ -19,9 +19,9 @@ func isFullGraphic(s string) bool {
return true
}
// SyncExerciceKeys reads the content of challenge.txt and import "classic" flags as Key for the given challenge.
func SyncExerciceKeys(i Importer, exercice fic.Exercice) (errs []string) {
if _, err := exercice.WipeKeys(); err != nil {
// SyncExerciceFlags reads the content of challenge.txt and import "classic" flags as Key for the given challenge.
func SyncExerciceFlags(i Importer, exercice fic.Exercice) (errs []string) {
if _, err := exercice.WipeFlags(); err != nil {
errs = append(errs, err.Error())
} else if _, err := exercice.WipeMCQs(); err != nil {
errs = append(errs, err.Error())
@ -40,7 +40,7 @@ func SyncExerciceKeys(i Importer, exercice fic.Exercice) (errs []string) {
errs = append(errs, fmt.Sprintf("%q: WARNING flag #%d: non-printable characters in flag, is this really expected?", path.Base(exercice.Path), nline + 1))
}
if k, err := exercice.AddRawKey(flag.Label, flag.Help, flag.IgnoreCase, flag.Raw); err != nil {
if k, err := exercice.AddRawFlag(flag.Label, flag.Help, flag.IgnoreCase, flag.Raw); err != nil {
errs = append(errs, fmt.Sprintf("%q: error flag #%d: %s", path.Base(exercice.Path), nline + 1, err))
continue
} else {
@ -67,7 +67,7 @@ func SyncExerciceKeys(i Importer, exercice fic.Exercice) (errs []string) {
errs = append(errs, fmt.Sprintf("%q: WARNING flag UCQ #%d: non-printable characters in flag, is this really expected?", path.Base(exercice.Path), nline + 1))
}
if k, err := exercice.AddRawKey(flag.Label, flag.Help, flag.IgnoreCase, flag.Raw); err != nil {
if k, err := exercice.AddRawFlag(flag.Label, flag.Help, flag.IgnoreCase, flag.Raw); err != nil {
errs = append(errs, fmt.Sprintf("%q: error flag UCQ #%d: %s", path.Base(exercice.Path), nline + 1, err))
continue
} else {

View file

@ -34,7 +34,7 @@ func SyncDeep(i Importer) (errs map[string][]string) {
if exercices, err := theme.GetExercices(); err == nil {
for _, exercice := range exercices {
errs[theme.Name] = append(errs[theme.Name], SyncExerciceKeys(i, exercice)...)
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFlags(i, exercice)...)
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...)
errs[theme.Name] = append(errs[theme.Name], SyncExerciceHints(i, exercice)...)
}