Skip to content

Commit

Permalink
feat(aws)!: Remove aws subcommand (#6995)
Browse files Browse the repository at this point in the history
  • Loading branch information
simar7 authored Jun 25, 2024
1 parent 648ead9 commit 979e118
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 76 deletions.
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

0 comments on commit 979e118

Please sign in to comment.