Skip to content

Commit

Permalink
fix: drop which in favor of command -v
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Oct 28, 2021
1 parent b146483 commit 6c709f2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion contrib/dokku_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ main() {
}
}

if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(command -v dokku) ]]; then
main "$@"
exit $?
fi
2 changes: 1 addition & 1 deletion plugins/00_dokku-standard/install
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(hostname -f)") ]] && hostname -f >"$DOKKU_ROOT/VHOST"
fi

dokku_path="$(which dokku)"
dokku_path="$(command -v dokku)"

# temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot
Expand Down
4 changes: 2 additions & 2 deletions plugins/nginx-vhosts/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ nginx_needs_upgrade() {
local MAJOR_VERSION MINOR_VERSION
local NEEDS_UPGRADE=true

if ! which nginx >/dev/null 2>&1; then
if ! command -v nginx &>/dev/null; then
echo $NEEDS_UPGRADE
return
fi
Expand Down Expand Up @@ -45,7 +45,7 @@ trigger-nginx-vhosts-dependencies() {
return
fi

if ! which nginx >/dev/null 2>&1; then
if ! command -v nginx &>/dev/null; then
nginx_install
return
fi
Expand Down
2 changes: 1 addition & 1 deletion plugins/nginx-vhosts/internal-functions
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn-nginx-vhosts-nginx-location() {
declare desc="check that nginx is at the expected location and return it"
local NGINX_LOCATION

NGINX_LOCATION=$(which nginx 2>/dev/null)
NGINX_LOCATION=$(command -v nginx 2>/dev/null)
if [[ -z "$NGINX_LOCATION" ]]; then
NGINX_LOCATION="/usr/sbin/nginx"
fi
Expand Down
2 changes: 1 addition & 1 deletion plugins/scheduler-docker-local/install
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trigger-scheduler-docker-local-install() {

fn-plugin-property-setup "scheduler-docker-local"

DOKKU_PATH="$(which dokku)"
DOKKU_PATH="$(command -v dokku)"

if [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then
cat <<EOF >/etc/systemd/system/dokku-retire.service
Expand Down
1 change: 0 additions & 1 deletion tests/shellcheck-exclude
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
# SC2207 - Prefer mapfile or read -a to split command output (or quote to avoid splitting) - https://github.com/koalaman/shellcheck/wiki/SC2207
# SC2219 - Instead of 'let expr', prefer (( expr )) - https://github.com/koalaman/shellcheck/wiki/SC2219
# SC2220 - Invalid flags are not handled. Add a *) case - https://github.com/koalaman/shellcheck/wiki/SC2220
# SC2230 - which is non-standard. Use builtin 'command -v' instead - https://github.com/koalaman/shellcheck/wiki/SC2230
# SC2231 - Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt - https://github.com/koalaman/shellcheck/wiki/SC2231
# SC2235 - Use { ..; } instead of (..) to avoid subshell overhead - https://github.com/koalaman/shellcheck/wiki/SC2235
# SC2267 - GNU xargs -i is deprecated in favor of -I{} - https://github.com/koalaman/shellcheck/wiki/SC2267
2 changes: 1 addition & 1 deletion tests/test_deploy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -xeo pipefail

SELF=$(which "$0")
SELF=$(command -v "$0")
APP="$1"
TARGET="$2"
FORWARDED_PORT="$3"
Expand Down

0 comments on commit 6c709f2

Please sign in to comment.