install: check dependencies before running

This commit is contained in:
Fernando Schauenburg 2022-02-07 19:56:39 +01:00
parent 56ab8011fe
commit 08cd87e019

View file

@ -17,6 +17,7 @@ main() {
*) usage; exit 1;;
esac done
check_dependencies
greeting
make_dirs
stow_home
@ -25,6 +26,15 @@ main() {
nvim_plugins
}
check_dependencies() {
for cmd in stow readlink; do
if ! command -v "$cmd" >/dev/null 2>&1; then
error "Dependency \`$cmd\` not found."
exit 1
fi
done
}
greeting() {
dry_run && {
warn "Performing dry run (use -f to actually make changes)."