Skip to content

Commit

Permalink
fix: Bring back get alerts project flags (#186)
Browse files Browse the repository at this point in the history
## Motivation

Alerts, while not directly Project scoped, support Project filtering.
With the changes introduced in #177,
the flag was removed.
This PR brings it back.

## Testing

Build sloctl with `make build` locally and run `sloctl get alert -A` and
`sloctl get alert -p <project_name>`.

## Release Notes

`sloctl get alert` once again supports both `-p` and `-A` flags for
Project filtering.
These flags were removed as a regression in v0.4.0.
  • Loading branch information
nieomylnieja authored Aug 12, 2024
1 parent b436934 commit 370a0cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ var projectFlagSupportingKinds = map[manifest.Kind]struct{}{
manifest.KindDataExport: {},
manifest.KindRoleBinding: {},
manifest.KindAnnotation: {},
// While Alert itself is not Project scoped per-se,
// it does support Project filtering.
manifest.KindAlert: {},
}

func objectKindSupportsProjectFlag(kind manifest.Kind) bool {
Expand Down
2 changes: 1 addition & 1 deletion internal/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (g *GetCmd) newGetAlertCommand(cmd *cobra.Command) *cobra.Command {
return err
}
if len(objects) == 0 {
fmt.Printf("No resources found.\n")
fmt.Printf("No resources found in '%s' project.\n", g.client.Config.Project)
return nil
}
if err = g.printObjects(objects); err != nil {
Expand Down

0 comments on commit 370a0cf

Please sign in to comment.