mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Allow eval only on asdf function at lib/asdf.sh.
It's needed for `asdf shell` command.
This commit is contained in:
parent
d76f639c75
commit
5ab01f49df
@ -9,7 +9,7 @@ asdf() {
|
||||
case "$command" in
|
||||
"shell")
|
||||
# commands that need to export variables
|
||||
eval "$(asdf export-shell-version sh "$@")"
|
||||
eval "$(asdf export-shell-version sh "$@")" # asdf_allow: eval
|
||||
;;
|
||||
*)
|
||||
# forward other commands to asdf script
|
||||
|
@ -12,7 +12,7 @@ banned_commands=(
|
||||
|
||||
# does not work on alpine and should be grep -i either way
|
||||
"grep -y"
|
||||
)
|
||||
)
|
||||
|
||||
setup() {
|
||||
setup_asdf_dir
|
||||
@ -25,8 +25,10 @@ teardown() {
|
||||
@test "banned commands are not found in source code" {
|
||||
for cmd in "${banned_commands[@]}"; do
|
||||
# Assert command is not used in the lib and bin dirs
|
||||
run grep -nHR "$cmd" lib bin
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "" ]
|
||||
# or expect an explicit comment at end of line, allowing it.
|
||||
run bash -c "grep -nHR '$cmd' lib bin | grep -v '# asdf_allow: $cmd'"
|
||||
echo "banned command $cmd: $output"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "" == "$output" ]
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user