diff --git a/LICENSE b/LICENSE index f266579..51a7970 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Better Mortgage +Copyright (c) 2018-2019 Better Mortgage Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/main.go b/main.go index 85c16ce..8879968 100644 --- a/main.go +++ b/main.go @@ -131,16 +131,34 @@ func filterObjectsByLabel(objects []runtime.Object, label string) []runtime.Obje return filteredObjects } +func filterObjectsByNamespace(objects []runtime.Object, namespace string) []runtime.Object { + if namespace == "" { + return objects + } + + filteredObjects := make([]runtime.Object, 0, 1) + for _, o := range objects { + metadata, _ := getObjectMetadata(o) + if metadata.GetNamespace() == namespace { + filteredObjects = append(filteredObjects, o) + } + } + + return filteredObjects +} + func main() { //todo: exit status, write to stderr, embed version and build flag.Usage = func() { fmt.Println("Usage: kubechange -l