1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00
portainer/pkg/libkubectl/resource.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
497 B
Go
Raw Normal View History

package libkubectl
import "strings"
func isManifestFile(resource string) bool {
trimmedResource := strings.TrimSpace(resource)
return strings.HasSuffix(trimmedResource, ".yaml") || strings.HasSuffix(trimmedResource, ".yml")
}
func resourcesToArgs(resources []string) []string {
args := []string{}
for _, resource := range resources {
if isManifestFile(resource) {
args = append(args, "-f", strings.TrimSpace(resource))
} else {
args = append(args, resource)
}
}
return args
}