diff --git a/install.sh b/install.sh index 214ad9a..570835e 100755 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ set -eu ARG1="$([ $# -eq 1 ] && echo "$1" || echo "")" -has() { type "$1" > /dev/null 2>&1; } +command_exists() { type "$1" >/dev/null 2>&1; } file_exists() { [ -f $1 ]; } dir_exists() { [ -d $1 ]; } is_update_mode() { [ "$ARG1" = "update" ] || [ "$ARG1" = "-u" ]; } @@ -19,7 +19,7 @@ DOTDIR="$HOME/dotfiles" : "${XDG_DATA_HOME:="$HOME/.local/share"}" : "${ZDOTDIR:="$XDG_CONFIG_HOME/zsh"}" -if ! has git; then +if ! command_exists git; then warn "you must install git!" exit 1 fi diff --git a/scripts/check_requirements.sh b/scripts/check_requirements.sh index 44d738a..3873925 100644 --- a/scripts/check_requirements.sh +++ b/scripts/check_requirements.sh @@ -2,7 +2,7 @@ check_requirements() { info "check requirements..." local is_every_requirement_met=true - if ! has nvim && ! file_exists "$HOME/local/nvim/bin/nvim"; then + if ! command_exists nvim && ! file_exists "$HOME/local/nvim/bin/nvim"; then warn "you must install neovim! please see installing-neovim : https://github.com/neovim/neovim/wiki/Installing-Neovim" is_every_requirement_met=false fi @@ -18,7 +18,7 @@ check_requirements() { cd - fi - if ! has zsh; then + if ! command_exists zsh; then warn "zsh isn't installed" is_every_requirement_met=false else @@ -33,7 +33,7 @@ check_requirements() { fi fi - if ! has tmux; then + if ! command_exists tmux; then warn "tmux isn't installed" is_every_requirement_met=false else diff --git a/scripts/deploy.sh b/scripts/deploy.sh index fefc1cf..c829451 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -44,7 +44,7 @@ deploy() { symlink starship.toml "$XDG_CONFIG_HOME/starship.toml" mkdir -p "$XDG_DATA_HOME/rustup" - if has ranger && ! dir_exists "$DOTDIR/ranger/plugins/ranger_devicons"; then + if command_exists ranger && ! dir_exists "$DOTDIR/ranger/plugins/ranger_devicons"; then git clone https://github.com/alexanderjeurissen/ranger_devicons "$DOTDIR/ranger/plugins/ranger_devicons" cd "$DOTDIR/ranger/plugins/ranger_devicons" make install