Merge pull request #126 from foomo/pivotal-license-finder-sources

feat(pivotal/licensefinder): add sources config
This commit is contained in:
Kevin Franklin Kim 2024-07-23 08:39:05 +02:00 committed by GitHub
commit fbc4f2b788
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -18,5 +18,8 @@ func New(l log.Logger) (plugin.Plugin, error) {
licenseFinder:
logPath: .posh/logs/licenses.log
decisionsPath: .posh/licenses.yaml
sources:
- go.mod
- yarn.lock
```

View File

@ -239,8 +239,9 @@ func (c *Command) execute(ctx context.Context, r *readline.Readline, args ...str
func (c *Command) aggregatePaths(ctx context.Context) string {
var paths []string
paths = append(paths, c.paths(ctx, "go.sum")...)
paths = append(paths, c.paths(ctx, "yarn.lock")...)
for _, file := range c.cfg.Sources {
paths = append(paths, c.paths(ctx, file)...)
}
paths = lo.Uniq(paths)
sort.Strings(paths)
c.l.Info("Aggregating liceses from:")

View File

@ -1,6 +1,7 @@
package licensefinder
type Config struct {
LogPath string `json:"logPath" yaml:"logPath"`
DecisionsPath string `json:"decisionsPath" yaml:"decisionsPath"`
LogPath string `json:"logPath" yaml:"logPath"`
DecisionsPath string `json:"decisionsPath" yaml:"decisionsPath"`
Sources []string `json:"sources" yaml:"sources"`
}