Stores ignorecase property for flags
This commit is contained in:
parent
3146e75ead
commit
f36e1c4e4d
6 changed files with 19 additions and 13 deletions
|
|
@ -190,7 +190,8 @@ func deleteExerciceHint(hint fic.EHint, _ []byte) (interface{}, error) {
|
|||
|
||||
type uploadedKey struct {
|
||||
Label string
|
||||
Help string
|
||||
Help string
|
||||
ICase bool
|
||||
Key string
|
||||
Hash []byte
|
||||
}
|
||||
|
|
@ -205,7 +206,7 @@ func createExerciceKey(exercice fic.Exercice, body []byte) (interface{}, error)
|
|||
return nil, errors.New("Key not filled")
|
||||
}
|
||||
|
||||
return exercice.AddRawKey(uk.Label, uk.Help, uk.Key)
|
||||
return exercice.AddRawKey(uk.Label, uk.Help, uk.ICase, uk.Key)
|
||||
}
|
||||
|
||||
func showExerciceKey(key fic.Key, _ fic.Exercice, body []byte) (interface{}, error) {
|
||||
|
|
@ -225,6 +226,7 @@ func updateExerciceKey(key fic.Key, exercice fic.Exercice, body []byte) (interfa
|
|||
}
|
||||
|
||||
key.Help = uk.Help
|
||||
key.IgnoreCase = uk.ICase
|
||||
key.Checksum = uk.Hash
|
||||
|
||||
if _, err := key.Update(); err != nil {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ type ExerciceFlagUCQChoice struct {
|
|||
type ExerciceFlagUCQ struct {
|
||||
Label string `toml:",omitempty"`
|
||||
Raw string
|
||||
IgnoreCase bool `toml:",omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
DisplayAs string `toml:",omitempty"`
|
||||
Choices_Cost int64 `toml:",omitempty"`
|
||||
|
|
|
|||
|
|
@ -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.Raw); err != nil {
|
||||
if k, err := exercice.AddRawKey(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.Raw); err != nil {
|
||||
if k, err := exercice.AddRawKey(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 {
|
||||
|
|
|
|||
Reference in a new issue