1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/cmd/cli/kubectl-kyverno/variables/utils.go
Charles-Edouard Brétéché 2d8c74eb12
chore: improve unit tests in cli (#8296)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 17:01:23 +00:00

22 lines
447 B
Go

package variables
import (
"strings"
)
func NeedsVariable(variable string) bool {
return variable != "" &&
!strings.Contains(variable, "request.object") &&
!strings.Contains(variable, "request.operation") &&
!strings.Contains(variable, "element") &&
variable != "elementIndex"
}
func NeedsVariables(variables ...string) bool {
for _, variable := range variables {
if NeedsVariable(variable) {
return true
}
}
return false
}