Last active
November 4, 2022 11:18
-
-
Save mesuutt/3a18f848479a613b01952dfe23f61837 to your computer and use it in GitHub Desktop.
Revisions
-
mesuutt revised this gist
Nov 4, 2022 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,22 @@ #!/bin/bash # exit on error set -e CONF_DIR=~/.kube/config.d require() { if ! hash "$1" &>/dev/null; then echo "'$1' not found in PATH" exit 1 fi } require yq for f in $CONF_DIR/*.{yml,conf}; do name=$(cat $f | yq -r '.clusters[0].name') if [[ ! "$name" == "null" ]]; then echo "$f === $name" -
mesuutt created this gist
Sep 12, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ #!/bin/bash CONF_DIR=~/.kube/config.d for f in $CONF_DIR/*.yml; do name=$(cat $f | yq -r '.clusters[0].name') if [[ ! "$name" == "null" ]]; then echo "$f === $name" mv $f "$CONF_DIR/$name.yml" fi done