Skip to content

Commit

Permalink
feat(cli): warning for root command (#1516)
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 authored Dec 24, 2021
1 parent 76249bd commit 8f737cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/aquasecurity/trivy/pkg/commands/plugin"
"github.com/aquasecurity/trivy/pkg/commands/server"
tdb "github.com/aquasecurity/trivy/pkg/db"
"github.com/aquasecurity/trivy/pkg/log"
"github.com/aquasecurity/trivy/pkg/result"
"github.com/aquasecurity/trivy/pkg/types"
"github.com/aquasecurity/trivy/pkg/utils"
Expand Down Expand Up @@ -351,7 +352,10 @@ func NewApp(version string) *cli.App {

runAsPlugin := os.Getenv("TRIVY_RUN_AS_PLUGIN")
if runAsPlugin == "" {
app.Action = artifact.ImageRun
app.Action = func(ctx *cli.Context) error {
log.Logger.Warn("The root command will be removed. Please migrate to 'trivy image' command. See https://github.com/aquasecurity/trivy/discussions/1515")
return artifact.ImageRun(ctx)
}
} else {
app.Action = func(ctx *cli.Context) error {
return plugin.RunWithArgs(ctx.Context, runAsPlugin, ctx.Args().Slice())
Expand Down

0 comments on commit 8f737cc

Please sign in to comment.