#!/usr/bin/env bash set -eo pipefail DEPS_PATH="${HOME}/.deps" install-fzf() { local install_path="${1}/fzf" git clone --depth 1 https://github.com/junegunn/fzf.git "${install_path}" "${install_path}/install" \ --key-bindings \ --completion \ --no-update-rc \ --xdg } check-script-deps() { commands_to_check=( git ) for cmd in "${commands_to_check[@]}"; do if ! command -v "${cmd}"; then printf "Could not find command: \"%s\"!\n" "${cmd}" >&2 return 1 fi done } main() { printf "Creating dependencies directory as \"%s\"\n" "${DEPS_PATH}" >&2 mkdir -p "${DEPS_PATH}" printf "Checking script dependencies...\n" >&2 if ! check-script-deps; then printf \ "Script dependencies failed, install missing dependencies and try again\n" \ >&2 fi printf "Installing FZF\n" >&2 install-fzf "${DEPS_PATH}" }