-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (36 loc) · 1.05 KB
/
main.go
File metadata and controls
43 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/alecthomas/kong"
"github.com/califio/code-secure-analyzer"
"github.com/califio/code-secure-analyzer/logger"
"trivy/trivy"
)
type DependencyCmd struct {
SkipDbUpdate bool `help:"Skip DB update" env:"TRIVY_SKIP_DB_UPDATE" default:"false"`
ProjectPath string `help:"Project path" env:"PROJECT_PATH" default:"."`
}
func (r *DependencyCmd) Run() error {
dependencyAnalyzer := analyzer.NewScaAnalyzer()
dependencyAnalyzer.RegisterScanner(&trivy.DependencyScanner{
SkipDbUpdate: r.SkipDbUpdate,
ProjectPath: r.ProjectPath,
})
dependencyAnalyzer.Run()
return nil
}
type ContainerCmd struct {
Image string `env:"DOCKER_IMAGE" name:"image" help:"docker image" type:"string"`
}
func (r *ContainerCmd) Run() error {
logger.Info("coming soon")
return nil
}
var cli struct {
Dependency DependencyCmd `cmd:"" help:"Scan dependency project"`
Container ContainerCmd `cmd:"" help:"Scan container"`
}
func main() {
ctx := kong.Parse(&cli, kong.Name("analyzer"), kong.UsageOnError())
err := ctx.Run()
ctx.FatalIfErrorf(err)
}