Skip to content

Commit

Permalink
feat: allow multiple sources for shell module
Browse files Browse the repository at this point in the history
  • Loading branch information
axtloss committed Sep 13, 2024
1 parent c88fcf8 commit 30e4062
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
type ShellModule struct {
Name string `json:"name"`
Type string `json:"type"`
Source api.Source
Sources []api.Source
Commands []string
}

Expand All @@ -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
}
}
}

Expand Down

0 comments on commit 30e4062

Please sign in to comment.