lib/utils: refactor "{type => _omb_util_command}_exists"

This commit is contained in:
Koichi Murase
2021-12-28 07:34:53 +09:00
parent f22cba2905
commit 56c72b87fa
6 changed files with 54 additions and 23 deletions

View File

@@ -4,6 +4,6 @@
[[ ${SDKMAN_DIR-} ]] || export SDKMAN_DIR=~/.sdkman
# Try to load sdk only if the command is not available
if ! type_exists sdk && [[ -s $SDKMAN_DIR/bin/sdkman-init.sh ]]; then
if ! _omb_util_command_exists sdk && [[ -s $SDKMAN_DIR/bin/sdkman-init.sh ]]; then
source "$SDKMAN_DIR/bin/sdkman-init.sh"
fi

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Check if zoxide is installed
if type_exists zoxide; then
if _omb_util_command_exists zoxide; then
eval "$(zoxide init bash)"
else
echo '[oh-my-bash] zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide'