From 033ddb0920d8344dc538f5cf7ee13d1b71dec230 Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Thu, 2 Jan 2020 17:14:13 -0500 Subject: [PATCH] krew: add wrapper and update packaging for use by krew Signed-off-by: Marques Johansson --- .goreleaser.yml | 1 + bin/kubectl-crossplane | 8 +++++--- bin/kubectl-crossplane-krew-wrapper | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100755 bin/kubectl-crossplane-krew-wrapper diff --git a/.goreleaser.yml b/.goreleaser.yml index 7246300..8aa2b92 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -93,6 +93,7 @@ archives: # that functionality to bundle our bash scripts into the archive. files: - bin/kubectl-crossplane-* + - LICENSE checksum: name_template: 'checksums.txt' diff --git a/bin/kubectl-crossplane b/bin/kubectl-crossplane index 3a574b7..2428a88 100755 --- a/bin/kubectl-crossplane +++ b/bin/kubectl-crossplane @@ -22,7 +22,9 @@ function check_help { check_help "${1}" -if [[ $# -lt 1 ]] ; then - usage - exit 1 +if [[ $# -gt 0 ]] ; then + echo "Unknown command: $1" >&2 fi + +usage +exit 1 diff --git a/bin/kubectl-crossplane-krew-wrapper b/bin/kubectl-crossplane-krew-wrapper new file mode 100755 index 0000000..91d273a --- /dev/null +++ b/bin/kubectl-crossplane-krew-wrapper @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Wrapper to unify all crossplane-cli plugin commands +# for use by krew + +set -e +BASEDIR=$(dirname $(realpath "$0")) + +PATH="${BASEDIR}:${PATH}" exec kubectl crossplane "$@"