File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ function error_exit() {
3030# #######################
3131
3232function show_help() {
33- if [ -t 1 ] && which tput > /dev/null 2>&1 ; then
33+ if [ -t 1 ] && hash tput 2 > /dev/null; then
3434 local -r b=$( tput bold)
3535 local -r i=$( tput sitm)
3636 local -r n=$( tput sgr0)
171171# clang-format.
172172declare format=" ${CLANG_FORMAT:- } "
173173if [ -z " $format " ]; then
174- format=$( which clang-format)
174+ format=$( type -p clang-format)
175175fi
176176
177177if [ -z " $format " ]; then
@@ -206,8 +206,8 @@ if [ "$whole_file" = false ]; then
206206 done < <( compgen -G " /usr/local/clang+llvm*/share/clang/clang-format-diff.py" | sort " $sort_version " -r)
207207 # Maybe it's in the $PATH already? This is true for Ubuntu and Debian.
208208 paths_to_try+=( \
209- " $( which clang-format-diff 2> /dev/null || echo " $invalid " ) " \
210- " $( which clang-format-diff.py 2> /dev/null || echo " $invalid " ) " \
209+ " $( type -p clang-format-diff 2> /dev/null || echo " $invalid " ) " \
210+ " $( type -p clang-format-diff.py 2> /dev/null || echo " $invalid " ) " \
211211 )
212212 # Fedora.
213213 paths_to_try+=( \
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ set -o pipefail
1111
1212readonly bash_source=" ${BASH_SOURCE[0]:- $0 } "
1313
14- if [ -t 1 ] && which tput > /dev/null 2>&1 ; then
14+ if [ -t 1 ] && hash tput 2 > /dev/null; then
1515 readonly b=$( tput bold)
1616 readonly i=$( tput sitm)
1717 readonly n=$( tput sgr0)
@@ -272,7 +272,7 @@ if [ "$interactive" = false ]; then
272272 exit 1
273273fi
274274
275- if which colordiff > /dev/null 2>&1 ; then
275+ if hash colordiff 2 > /dev/null; then
276276 colordiff < " $patch "
277277else
278278 echo " ${b} (Install colordiff to see this diff in color!)${n} "
You can’t perform that action at this time.
0 commit comments