From 30e4062c8e628b95709c48179400d39612eeccc1 Mon Sep 17 00:00:00 2001 From: axtloss Date: Tue, 3 Sep 2024 22:25:17 +0200 Subject: [PATCH] feat: allow multiple sources for shell module --- core/shell.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/shell.go b/core/shell.go index c4f03aa..1ddcfd5 100644 --- a/core/shell.go +++ b/core/shell.go @@ -11,7 +11,7 @@ import ( type ShellModule struct { Name string `json:"name"` Type string `json:"type"` - Source api.Source + Sources []api.Source Commands []string } @@ -22,14 +22,16 @@ func BuildShellModule(moduleInterface interface{}, recipe *api.Recipe) (string, return "", err } - if strings.TrimSpace(module.Source.Type) != "" { - err := api.DownloadSource(recipe.DownloadsPath, module.Source, module.Name) - if err != nil { - return "", err - } - err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, module.Source, module.Name) - if err != nil { - return "", err + for _, source := range module.Sources { + if strings.TrimSpace(source.Type) != "" { + err := api.DownloadSource(recipe.DownloadsPath, source, module.Name) + if err != nil { + return "", err + } + err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, source, module.Name) + if err != nil { + return "", err + } } }