-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·47 lines (35 loc) · 1.24 KB
/
setup.sh
File metadata and controls
executable file
·47 lines (35 loc) · 1.24 KB
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
#!/usr/bin/env zsh
set -eu
mkdir -p "$PWD/tmp"
cd $(dirname $0)
[ ! -d backup ] && mkdir backup
for dotfile in .?*; do
if [ $dotfile != '..' ] && [ $dotfile != '.git' ] && [ $dotfile != '.gitmodules' ]; then
if [ -f "$HOME/$dotfile" ] && [ ! -L "$HOME/$dotfile" ]; then
mv "$HOME/$dotfile" "$PWD/backup"
fi
ln -fs "$PWD/$dotfile" $HOME
fi
done
# Generate credentials
read "OCO_API_KEY?Please input OCO_API_KEY (OpenAI API Key) for OpenCommit: "
cat > ~/.zsh/credentials <<EOS
# OpenAI API Key for OpenCommit
export OCO_API_KEY=$OCO_API_KEY
EOS
# submoduleの読み込み
git submodule update --init
# Build diff-highlight
make --directory externals/git/contrib/diff-highlight
# $HOME/binを作成して必要なスクリプトを配置
mkdir -p $HOME/bin
ln -fs "$PWD/externals/git/contrib/diff-highlight/diff-highlight" "$HOME/bin/"
# Copy git-prompt.sh to personalize
cp "$PWD/externals/git/contrib/completion/git-prompt.sh" "$HOME/.zsh/"
# Setup antigen to manage zsh plugins
curl -L git.io/antigen > $HOME/.zsh/antigen.zsh
# Prepare directory for zsh completions
mkdir -p $HOME/.zsh/completions
autoload -U compinit
rm -f $HOME/.zcompdump; compinit
echo "[NOTICE] Please restart shell to apply completion for git"