#!/usr/bin/env bash

[[ $# != 1 ]] && exit 1

dir=$1
base=${dir}/../base

if [[ -f "${base}"/kustomization.yaml ]] && [[ -f "${dir}"/kustomization.yaml ]]; then
    cat > "${base}"/_manifest.yaml
    kubectl kustomize "${dir}"
else
    cat
fi
