plugins/base: use `_command_exists`

Addresses bash-it/bash-it#1632
pull/1938/head
John D Pell 2021-09-09 16:17:00 -07:00
parent 3e2ec1232d
commit 39d6488c6b
1 changed files with 4 additions and 4 deletions

View File

@ -5,10 +5,10 @@ function ips ()
{ {
about 'display all ip addresses for this host' about 'display all ip addresses for this host'
group 'base' group 'base'
if command -v ifconfig &>/dev/null if _command_exists ifconfig
then then
ifconfig | awk '/inet /{ gsub(/addr:/, ""); print $2 }' ifconfig | awk '/inet /{ gsub(/addr:/, ""); print $2 }'
elif command -v ip &>/dev/null elif _command_exists ip
then then
ip addr | grep -oP 'inet \K[\d.]+' ip addr | grep -oP 'inet \K[\d.]+'
else else
@ -70,7 +70,7 @@ function passgen ()
# Create alias pass to passgen when pass isn't installed or # Create alias pass to passgen when pass isn't installed or
# BASH_IT_LEGACY_PASS is true. # BASH_IT_LEGACY_PASS is true.
if ! command -v pass &>/dev/null || [[ "${BASH_IT_LEGACY_PASS:-}" = true ]] if ! _command_exists pass || [[ "${BASH_IT_LEGACY_PASS:-}" = true ]]
then then
alias pass=passgen alias pass=passgen
fi fi
@ -81,7 +81,7 @@ function pmdown ()
param '1: markdown file' param '1: markdown file'
example '$ pmdown README.md' example '$ pmdown README.md'
group 'base' group 'base'
if command -v markdown &>/dev/null if _command_exists markdown
then then
markdown $1 | browser markdown $1 | browser
else else