Skip to content

Commit 979e118

Browse files
authored
feat(aws)!: Remove aws subcommand (#6995)
1 parent 648ead9 commit 979e118

File tree

3 files changed

+9
-76
lines changed

3 files changed

+9
-76
lines changed

pkg/commands/app.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ func NewApp() *cobra.Command {
9393
NewKubernetesCommand(globalFlags),
9494
NewSBOMCommand(globalFlags),
9595
NewVersionCommand(globalFlags),
96-
NewAWSCommand(),
9796
NewVMCommand(globalFlags),
9897
)
9998

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

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

@@ -1014,14 +1022,6 @@ func NewKubernetesCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
10141022
return cmd
10151023
}
10161024

1017-
func NewAWSCommand() *cobra.Command {
1018-
cmd := &cobra.Command{
1019-
Deprecated: "Trivy AWS is now available as an optional plugin. See github.com/aquasecurity/trivy-aws for details",
1020-
Use: "aws [flags]",
1021-
}
1022-
return cmd
1023-
}
1024-
10251025
func NewVMCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
10261026
vmFlags := &flag.Flags{
10271027
GlobalFlagGroup: globalFlags,

pkg/flag/cloud_flags.go

-55
This file was deleted.

pkg/flag/options.go

-12
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ type Flags struct {
301301
GlobalFlagGroup *GlobalFlagGroup
302302
AWSFlagGroup *AWSFlagGroup
303303
CacheFlagGroup *CacheFlagGroup
304-
CloudFlagGroup *CloudFlagGroup
305304
DBFlagGroup *DBFlagGroup
306305
ImageFlagGroup *ImageFlagGroup
307306
K8sFlagGroup *K8sFlagGroup
@@ -324,7 +323,6 @@ type Options struct {
324323
GlobalOptions
325324
AWSOptions
326325
CacheOptions
327-
CloudOptions
328326
DBOptions
329327
ImageOptions
330328
K8sOptions
@@ -527,9 +525,6 @@ func (f *Flags) groups() []FlagGroup {
527525
if f.RegoFlagGroup != nil {
528526
groups = append(groups, f.RegoFlagGroup)
529527
}
530-
if f.CloudFlagGroup != nil {
531-
groups = append(groups, f.CloudFlagGroup)
532-
}
533528
if f.AWSFlagGroup != nil {
534529
groups = append(groups, f.AWSFlagGroup)
535530
}
@@ -619,13 +614,6 @@ func (f *Flags) ToOptions(args []string) (Options, error) {
619614
}
620615
}
621616

622-
if f.CloudFlagGroup != nil {
623-
opts.CloudOptions, err = f.CloudFlagGroup.ToOptions()
624-
if err != nil {
625-
return Options{}, xerrors.Errorf("cloud flag error: %w", err)
626-
}
627-
}
628-
629617
if f.CacheFlagGroup != nil {
630618
opts.CacheOptions, err = f.CacheFlagGroup.ToOptions()
631619
if err != nil {

0 commit comments

Comments
 (0)