mirror of
https://github.com/portainer/portainer.git
synced 2025-07-18 21:09:40 +02:00
20 lines
497 B
Go
20 lines
497 B
Go
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
|
|
}
|