mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: improve readability of the non-set nullglob
guard (#1545)
This commit is contained in:
parent
b36ec73386
commit
f273612155
@ -21,16 +21,13 @@ plugin_remove_command() {
|
||||
rm -rf "$(asdf_data_dir)/installs/${plugin_name}"
|
||||
rm -rf "$(asdf_data_dir)/downloads/${plugin_name}"
|
||||
|
||||
local is_nullglob_disabled=
|
||||
shopt -q nullglob || is_nullglob_disabled=yes
|
||||
shopt -s nullglob
|
||||
for f in "$(asdf_data_dir)"/shims/*; do
|
||||
if grep -q "asdf-plugin: ${plugin_name}" "$f"; then
|
||||
rm -f "$f"
|
||||
if [ -f "$f" ]; then # nullglob may not be set
|
||||
if grep -q "asdf-plugin: ${plugin_name}" "$f"; then
|
||||
rm -f "$f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
[ "$is_nullglob_disabled" = 'yes' ] && shopt -u nullglob
|
||||
unset -v is_nullglob_disabled
|
||||
|
||||
asdf_run_hook "post_asdf_plugin_remove" "$plugin_name"
|
||||
asdf_run_hook "post_asdf_plugin_remove_${plugin_name}"
|
||||
|
Loading…
Reference in New Issue
Block a user