diff --git a/README.md b/README.md index 04bbc6e..c6749ba 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,14 @@ Is meant to be used either stand alone like: ```bash split-yaml -f longfile.yaml -o files ``` -to split longfile.yaml into multiple files, they will be named $(name)-$(kind).yaml and end up in the files directory (in this case). -Or it can be used when piping output into it like this: +to split longfile.yaml into multiple files, they will be named `$(name)-$(kind).yaml` and end up in the `./files/` directory (in this case). + +It can also be used when piping output into it like this: ```bash -kubectl get deploy,svc,configmap,ingress -o yaml | split-yaml -o files - +kubectl get deploy,svc,configmap,ingress -o yaml | split-yaml -o files -f - ``` To split the `kind: List` content into individual files. -Contributing PR's are welcome! If you want to expand it to use real kubernetes objects, I'm open to contributions. +**You must have LF line endings for this to work. CRLF would need to be converted to LF using git line ending normalization** -**You must have LF line endings for this to work. CRLF would need to be converted to LF using git line ending normalization** \ No newline at end of file +Feel free to reach out with suggestions or issues! diff --git a/helpers/helpers.go b/helpers/helpers.go index 8a0c289..acd5be3 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -52,19 +52,10 @@ func GetYamlKindName(y string) (string, string, error) { if r.Metadata.Name == "" { return "", "", fmt.Errorf("could not find 'metadata.name' in yaml") } - //fmt.Printf("Got kind: %v and name: %v", r.Kind, r.Metadata.Name) return strings.ToLower(r.Kind), r.Metadata.Name, nil } func GetKindAndNameFromYaml(y string) (string, string) { - // var obj interface{} - // err := yaml.Unmarshal([]byte(s), *obj) - // if err != nil { - // fmt.Printf("unable to unmarshal yaml, %v", err) - // return "", "", err - // } - // name := obj.Metadata.Name - // kind := obj.kind kind := "" name := "" @@ -84,7 +75,6 @@ func GetKindAndNameFromYaml(y string) (string, string) { if kind != "" && name != "" { break } - } return kind, name