-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.zsh
executable file
·69 lines (56 loc) · 1.57 KB
/
install.zsh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env zsh
# Color variables
orange="%F{214;202;216}"
green="%F{164;144;187}"
purple="%F{108;86;123}"
reset="%f"
simulate=false
setup_dotfiles() {
local target_dir=$1
local prefix_dot=${2:-yes}
local dot_files_dir=$PWD
local files=("${@:3}")
if $simulate; then
print -P "${orange}\n-- Simulating setup for ${green}$target_dir${purple} (Prefix Dot: ${green}$prefix_dot${purple})${reset}"
fi
for filename in "${files[@]}"
do
local target_filename=$filename
if [[ $prefix_dot == "yes" ]]; then
target_filename=".$filename"
fi
local symlink_cmd="ln -sf $dot_files_dir/$filename $target_dir/$target_filename"
if $simulate; then
echo "$symlink_cmd"
else
[[ -s $target_dir/$target_filename ]] && rm -${prefix_dot}i "$target_dir/$target_filename"
eval "$symlink_cmd"
fi
done
}
while (( $# > 0 )); do
case "$1" in
--simulate)
simulate=true
shift
;;
*)
break
;;
esac
done
files=(zshrc zsh irbrc alias vim gitconfig gitignore_global gemrc tmux.conf tmux tigrc exports ackrc wezterm.lua vale.ini codespellrc)
setup_dotfiles "$HOME" yes "${files[@]}"
source "$HOME/.exports"
config_dir_files=(nvim topgrade.toml starship.toml)
setup_dotfiles "$CONFIG_DIR" no "${config_dir_files[@]}"
ln -sf "$PWD/git-edit" "$HOME/.local/bin/git-edit"
# Install utilities
# Linter:
# https://github.com/redding/l.rb
#
# Test runner:
# https://github.com/redding/t.rb
curl -L https://git.io/l.rb--install | PREFIX=/.local sh
curl -L https://git.io/t.rb--install | PREFIX=/.local sh
source "$HOME/.zshrc"