WIP: generating new apps.json

This commit is contained in:
decentral1se 2021-09-17 08:04:16 +02:00
parent fdd46a4d98
commit d188327b17
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 20 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package catalogue
import (
"encoding/json"
"io/ioutil"
"path"
"strings"
@ -93,8 +95,24 @@ var catalogueGenerateCommand = &cli.Command{
<-ch // wait for everything
}
// for reach app, build the recipemeta from parsing
// spit out a JSON file
catl := make(catalogue.RecipeCatalogue)
for recipeName := range recipes {
// TODO: gather more metadata
catl[recipeName] = catalogue.RecipeMeta{
Name: recipeName,
}
}
recipesJSON, err := json.MarshalIndent(catl, "", " ")
if err != nil {
logrus.Fatal(err)
}
if err := ioutil.WriteFile(config.APPS_JSON, recipesJSON, 0644); err != nil {
logrus.Fatal(err)
}
logrus.Debugf("generated new recipe catalogue in '%s'", config.APPS_JSON)
return nil
},