completion/gradle: use `_command_exists`

pull/1938/head
John D Pell 2021-09-19 01:16:46 -07:00
parent 0ad1af8306
commit 679d8b10b6
1 changed files with 2 additions and 2 deletions

View File

@ -58,9 +58,9 @@ __gradle-set-cache-name() {
__gradle-set-files-checksum() { __gradle-set-files-checksum() {
# Cache MD5 sum of all Gradle scripts and modified timestamps # Cache MD5 sum of all Gradle scripts and modified timestamps
if builtin command -v md5 > /dev/null; then if _command_exists md5; then
gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)")
elif builtin command -v md5sum > /dev/null; then elif _command_exists md5sum; then
gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}')
else else
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH" echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"