feat: add installer
This commit is contained in:
parent
f2b0f37f96
commit
a4610227ae
41
install.bash
Normal file
41
install.bash
Normal file
@ -0,0 +1,41 @@
|
||||
#!/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}"
|
||||
}
|
Loading…
Reference in New Issue
Block a user