mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
refactor: prefer grep --quiet
over standard output redirection (#1655)
This commit is contained in:
parent
dfea89ccc7
commit
d7e0740461
@ -79,7 +79,7 @@ plugin_test_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2119
|
# shellcheck disable=SC2119
|
||||||
if ! (plugin_list_command | grep "^$plugin_name$" >/dev/null); then
|
if ! (plugin_list_command | grep -q "^$plugin_name$"); then
|
||||||
fail_test "$plugin_name was not properly installed"
|
fail_test "$plugin_name was not properly installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -90,8 +90,8 @@ plugin_test_command() {
|
|||||||
local plugin_path
|
local plugin_path
|
||||||
plugin_path=$(get_plugin_path "$plugin_name")
|
plugin_path=$(get_plugin_path "$plugin_name")
|
||||||
local list_all="$plugin_path/bin/list-all"
|
local list_all="$plugin_path/bin/list-all"
|
||||||
if grep api.github.com "$list_all" >/dev/null; then
|
if grep -q api.github.com "$list_all"; then
|
||||||
if ! grep Authorization "$list_all" >/dev/null; then
|
if ! grep -q Authorization "$list_all"; then
|
||||||
printf "\nLooks like %s/bin/list-all relies on GitHub releases\n" "$plugin_name"
|
printf "\nLooks like %s/bin/list-all relies on GitHub releases\n" "$plugin_name"
|
||||||
printf "but it does not properly sets an Authorization header to prevent\n"
|
printf "but it does not properly sets an Authorization header to prevent\n"
|
||||||
printf "GitHub API rate limiting.\n\n"
|
printf "GitHub API rate limiting.\n\n"
|
||||||
|
@ -18,7 +18,7 @@ remove_shim_for_version() {
|
|||||||
sed -i.bak -e "/# asdf-plugin: $plugin_name $version"'$/d' "$shim_path"
|
sed -i.bak -e "/# asdf-plugin: $plugin_name $version"'$/d' "$shim_path"
|
||||||
rm "$shim_path".bak
|
rm "$shim_path".bak
|
||||||
|
|
||||||
if ! grep "# asdf-plugin:" "$shim_path" >/dev/null ||
|
if ! grep -q "# asdf-plugin:" "$shim_path" ||
|
||||||
[ "$count_installed" -eq 0 ]; then
|
[ "$count_installed" -eq 0 ]; then
|
||||||
rm -f "$shim_path"
|
rm -f "$shim_path"
|
||||||
fi
|
fi
|
||||||
|
@ -60,7 +60,7 @@ version_command() {
|
|||||||
resolved_versions+=("$version")
|
resolved_versions+=("$version")
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f "$file" ] && grep "^$plugin_name " "$file" >/dev/null; then
|
if [ -f "$file" ] && grep -q "^$plugin_name " "$file"; then
|
||||||
local temp_dir
|
local temp_dir
|
||||||
temp_dir=${TMPDIR:-/tmp}
|
temp_dir=${TMPDIR:-/tmp}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user