Skip to content

Commit

Permalink
insert David's syntax suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Taimoor Ahmad committed Sep 25, 2023
1 parent 9c4101d commit 327932c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cmd/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,13 @@ opslevel get tag --type=Service ID|ALIAS KEY | jq
tags, err := GetTags(result)
cobra.CheckErr(err)

var output []opslevel.Tag
output := []opslevel.Tag{}
for _, tag := range tags.Nodes {
if tagKey == tag.Key {
output = append(output, tag)
}
}

// return empty JSON array instead of null
if len(output) == 0 {
output = make([]opslevel.Tag, 0)
}
common.PrettyPrint(output)
},
}
Expand Down

0 comments on commit 327932c

Please sign in to comment.