diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a37714..ffe11251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Features + +* Shims can be invoked directly via `asdf exec [args...]` without requiring to have all shims on path (#374). * Configurable command hooks from `.asdfrc` Suppose a `foo` plugin is installed and provides a `bar` executable, The following hooks will be executed when set: diff --git a/bin/private/asdf-exec b/bin/private/asdf-exec index ee811aee..929df22b 100755 --- a/bin/private/asdf-exec +++ b/bin/private/asdf-exec @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# remove this asdf-exec file when v0.7 becomes the stable version -echo "asdf is self upgrading shims to new asdf-tool-exec" +# remove this asdf-exec file when releasing >=0.6.5 +echo "asdf is self upgrading shims to new asdf exec ..." asdf_dir="$(dirname "$(dirname "$(dirname "$0")")")" # shellcheck source=lib/utils.sh diff --git a/test/shim_exec.bats b/test/shim_exec.bats index 768d6d70..2ad6128f 100644 --- a/test/shim_exec.bats +++ b/test/shim_exec.bats @@ -30,6 +30,20 @@ teardown() { [ "$status" -eq 0 ] } +@test "asdf exec should pass all arguments to executable even if shim is not in PATH" { + echo "dummy 1.0" > $PROJECT_DIR/.tool-versions + run install_command + + path=$(echo "$PATH" | sed -e "s|$(asdf_data_dir)/shims||g; s|::|:|g") + run env PATH=$path which dummy + [ "$output" == "" ] + [ "$status" -eq 1 ] + + run env PATH=$path $ASDF_DIR/bin/asdf exec dummy world hello + [ "$output" == "This is Dummy 1.0! hello world" ] + [ "$status" -eq 0 ] +} + @test "shim exec should pass all arguments to executable" { echo "dummy 1.0" > $PROJECT_DIR/.tool-versions run install_command