Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws)!: Remove aws subcommand #6995

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pkg/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func NewApp() *cobra.Command {
NewKubernetesCommand(globalFlags),
NewSBOMCommand(globalFlags),
NewVersionCommand(globalFlags),
NewAWSCommand(),
NewVMCommand(globalFlags),
)

Expand All @@ -105,6 +104,15 @@ func NewApp() *cobra.Command {
rootCmd.AddCommand(plugins...)
}

// TODO(simar7): Only for backwards support guidance, delete the subcommand after a while.
if cmd, _, _ := rootCmd.Find([]string{"aws"}); cmd == cmd.Root() { // "trivy aws" not installed
rootCmd.AddCommand(&cobra.Command{
Hidden: true,
Long: "Trivy AWS is now available as an optional plugin. See github.com/aquasecurity/trivy-aws for details.",
Use: "aws",
})
}

return rootCmd
}

Expand Down Expand Up @@ -1014,14 +1022,6 @@ func NewKubernetesCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
return cmd
}

func NewAWSCommand() *cobra.Command {
cmd := &cobra.Command{
Deprecated: "Trivy AWS is now available as an optional plugin. See github.com/aquasecurity/trivy-aws for details",
Use: "aws [flags]",
}
return cmd
}

func NewVMCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
vmFlags := &flag.Flags{
GlobalFlagGroup: globalFlags,
Expand Down
55 changes: 0 additions & 55 deletions pkg/flag/cloud_flags.go

This file was deleted.

12 changes: 0 additions & 12 deletions pkg/flag/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ type Flags struct {
GlobalFlagGroup *GlobalFlagGroup
AWSFlagGroup *AWSFlagGroup
CacheFlagGroup *CacheFlagGroup
CloudFlagGroup *CloudFlagGroup
DBFlagGroup *DBFlagGroup
ImageFlagGroup *ImageFlagGroup
K8sFlagGroup *K8sFlagGroup
Expand All @@ -324,7 +323,6 @@ type Options struct {
GlobalOptions
AWSOptions
CacheOptions
CloudOptions
DBOptions
ImageOptions
K8sOptions
Expand Down Expand Up @@ -527,9 +525,6 @@ func (f *Flags) groups() []FlagGroup {
if f.RegoFlagGroup != nil {
groups = append(groups, f.RegoFlagGroup)
}
if f.CloudFlagGroup != nil {
groups = append(groups, f.CloudFlagGroup)
}
if f.AWSFlagGroup != nil {
groups = append(groups, f.AWSFlagGroup)
}
Expand Down Expand Up @@ -619,13 +614,6 @@ func (f *Flags) ToOptions(args []string) (Options, error) {
}
}

if f.CloudFlagGroup != nil {
opts.CloudOptions, err = f.CloudFlagGroup.ToOptions()
if err != nil {
return Options{}, xerrors.Errorf("cloud flag error: %w", err)
}
}

if f.CacheFlagGroup != nil {
opts.CacheOptions, err = f.CacheFlagGroup.ToOptions()
if err != nil {
Expand Down