๐Ÿ“ฆ anlutro / dotfiles

๐Ÿ“„ update-vendors.sh ยท 33 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33#!/usr/bin/env sh

root=$(dirname "$(realpath "$0")")

update_fzf() {
    ./install --bin
}

update_git_crypt() {
    make && mv ./git-crypt ~/.local/bin
}

cd $root/vendor || exit 1
for dir in *; do
    name=$(basename "$dir")
    if [ ! -d "$dir" ]; then
        continue
    fi

    echo "Updating $name ..."
    cd $dir || exit 1
    git checkout .
    git pull

    func="update_$(echo "$name" | tr -s '-' '_')"
    if command -v "$func" >/dev/null 2>&1; then
        $func
    fi

    cd ..
    echo
done