From 257274a7d14673d084c4b3973fc5e2accde40e8c Mon Sep 17 00:00:00 2001 From: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com> Date: Sat, 24 Jul 2021 16:22:49 +0200 Subject: [PATCH] Chore Signed-off-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- konfig | 4 ++-- test/konfig.bats | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d987dd..478d002 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,6 @@ jobs: - name: Create PR in krew-index if: contains(github.ref, 'tags') - uses: rajatjindal/krew-release-bot@v0.0.36 + uses: rajatjindal/krew-release-bot@v0.0.40 with: krew_template_file: .konfig.yaml diff --git a/konfig b/konfig index 8e3350a..f6b9fa7 100755 --- a/konfig +++ b/konfig @@ -71,7 +71,7 @@ error() { } merge() { - if [[ "$1" =~ ^-(.*) && "$1" != '-p' && "$1" != '--preserve-structure' ]]; then + if [[ "$1" =~ ^-.+ && "$1" != '-p' && "$1" != '--preserve-structure' ]]; then error "unrecognized flag \"$1\"" else IFS=$':\n\t' @@ -139,7 +139,7 @@ export_contexts() { if [[ "$1" == '--kubeconfig' || "$1" == '-k' ]]; then cfgs+=( "${2//,/:}" ) shift 2 - elif [[ "$1" =~ ^-(.*) ]]; then + elif [[ "$1" =~ ^-.+ ]]; then error "unrecognized flag \"$1\"" else ctxs+=( "$1" ) diff --git a/test/konfig.bats b/test/konfig.bats index 788f2f6..90d969d 100644 --- a/test/konfig.bats +++ b/test/konfig.bats @@ -81,6 +81,16 @@ load common [[ $(check_fixture 'testdata/config12-flat' "$output") = 'same' ]] } +@test "import config with -- in name" { + use_config config1 + cp testdata/config-2 testdata/config--2 + run ${COMMAND} import testdata/config--2 + rm testdata/config--2 + echo "$output" + [[ "$status" -eq 0 ]] + [[ $(check_fixture 'testdata/config12-flat' "$output") = 'same' ]] +} + @test "import multiple configs and print to stdout" { use_config config1 run ${COMMAND} import testdata/config-2 testdata/config3 @@ -207,7 +217,7 @@ load common [[ "$output" = *"error: contexts to export are missing"* ]] } -@test "exporting without any context - I" { +@test "exporting without any context - II" { run ${COMMAND} export echo "$output" [[ "$status" -eq 1 ]]