Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active April 10, 2022 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/41cc3fa7c204d79afbf57bdf96b1bfea to your computer and use it in GitHub Desktop.
Save RichardBronosky/41cc3fa7c204d79afbf57bdf96b1bfea to your computer and use it in GitHub Desktop.
Helm plugin to list repos in a copy-paste friendly format for sharing
#! /usr/bin/env bash
set -eu
_usage(){
cat<<EOF
Usage:
./dependabot-merge.sh get_branches | ./dependabot-merge.sh checkout_merge_push_delete
EOF
_funcs | sed $'1i Functions:\n; s/^/ /'
}
_funcs(){
declare -F | awk '$2=="-f" && $3~/^[^_]/{print $3}'
}
function repos(){
helm repo list | sed '1d; s/^/helm repo add /'
}
_main(){
if [[ -n "$@" ]]; then
cmd="$1"; shift
$cmd "$@"
else
_usage
fi
}
_main "$@"
# SEE: https://www.datree.io/resources/how-to-build-a-helm-plugin-in-minutes
# https://helm.sh/docs/topics/plugins/#environment-variables
name: "repos"
usage: "helm repos"
description: "List repos in a copy-paste friendly format for sharing"
command: "$HELM_PLUGIN_DIR/plugin.bash repos"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment