Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active April 10, 2022 08:14

Revisions

  1. RichardBronosky created this gist Apr 10, 2022.
    30 changes: 30 additions & 0 deletions plugin.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #! /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 "$@"
    6 changes: 6 additions & 0 deletions plugin.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # 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"