1 #!/bin/bash |
1 #!/bin/bash |
2 set -euo pipefail |
2 set -euo pipefail |
3 |
3 |
4 if [ ! -f .zshrc ]; then |
4 warn() { echo "$*" >&2; } |
5 echo "Refusing to run without a .zshrc nearby" >&2 |
5 die() { warn "$*"; exit 1; } |
6 exit 1 |
|
7 fi |
|
8 |
|
9 if ! git --version >/dev/null; then |
|
10 echo "Please install git!" >&2 |
|
11 exit 1 |
|
12 fi |
|
13 |
6 |
14 clone_or_pull() { |
7 clone_or_pull() { |
15 if ! [ -d $2 ]; then |
8 if ! [ -d $2 ]; then |
16 git clone --single-branch --depth 1 "$1" $2 |
9 git clone --single-branch --depth 1 "$1" $2 |
17 else |
10 else |
18 echo "$2:" |
11 echo "$2:" |
19 git -C "$2" pull |
12 git -C "$2" pull |
20 fi |
13 fi |
21 } |
14 } |
|
15 |
|
16 [ -f .zshrc ] || |
|
17 die "Refusing to run without a .zshrc nearby" |
|
18 |
|
19 git --version >/dev/null || |
|
20 die "Please install git!" |
22 |
21 |
23 clone_or_pull 'https://github.com/tarjoilija/zgen.git' .zgen |
22 clone_or_pull 'https://github.com/tarjoilija/zgen.git' .zgen |
24 |
23 |
25 zsh -i -c 'zgen update' || : |
24 zsh -i -c 'zgen update' || : |
26 |
25 |