Initial commit

This commit is contained in:
nemunaire 2026-03-15 11:40:06 +07:00
commit c9b663f487
11 changed files with 645 additions and 0 deletions

45
main.go Normal file
View file

@ -0,0 +1,45 @@
package main
import (
"context"
"github.com/drone-plugins/drone-syft/plugin"
"github.com/kelseyhightower/envconfig"
"github.com/sirupsen/logrus"
)
func main() {
logrus.SetFormatter(new(formatter))
var args plugin.Args
if err := envconfig.Process("", &args); err != nil {
logrus.Fatalln(err)
}
switch args.Level {
case "debug":
logrus.SetFormatter(textFormatter)
logrus.SetLevel(logrus.DebugLevel)
case "trace":
logrus.SetFormatter(textFormatter)
logrus.SetLevel(logrus.TraceLevel)
}
if err := plugin.Exec(context.Background(), args); err != nil {
logrus.Fatalln(err)
}
}
// default formatter that writes logs without including timestamp
// or level information.
type formatter struct{}
func (*formatter) Format(entry *logrus.Entry) ([]byte, error) {
return []byte(entry.Message), nil
}
// text formatter that writes logs with level information
var textFormatter = &logrus.TextFormatter{
DisableTimestamp: true,
}