sync: Add Init and Sync functions

Init initializes the directory/repository before the first use.
Sync is called to unsure the directory is up-to-date.
This commit is contained in:
nemunaire 2021-10-26 19:56:40 +02:00
commit aebfb7bf96
7 changed files with 62 additions and 6 deletions

View file

@ -243,6 +243,12 @@ func SyncExercice(i Importer, theme fic.Theme, epath string, dmap *map[int64]fic
// SyncExercices imports new or updates existing exercices, in a given theme.
func SyncExercices(i Importer, theme fic.Theme) (errs []string) {
if !avoidImporterSync() {
if err := i.Sync(); err != nil {
errs = append(errs, err.Error())
}
}
if exercices, err := GetExercices(i, theme); err != nil {
errs = append(errs, err.Error())
} else {