File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,3 +43,14 @@ for file in $DOTFILES; do
4343done
4444
4545echo " ✅ すべてのシンボリックリンクを作成しました!"
46+
47+ # `git-prompt.sh`が環境になければインストール
48+ GIT_PROMPT_INSTALL_SCRIPT=" $DOTFILES_DIR /install_git-prompt.sh"
49+
50+ if [ -f " $GIT_PROMPT_INSTALL_SCRIPT " ]; then
51+ echo " Running install_git-prompt.sh ..."
52+ source " $GIT_PROMPT_INSTALL_SCRIPT "
53+ else
54+ echo " Error: install_git-prompt.sh が見つかりません"
55+ exit 1
56+ fi
Original file line number Diff line number Diff line change 1+ # Git prompt (__git_ps1) のロード(自動ダウンロード対応)
2+ if ! command -v git > /dev/null 2>&1 ; then
3+ echo " Git がインストールされていません"
4+ else
5+ # Git の git-prompt.sh の場所候補
6+ GIT_PROMPT_FILES=(
7+ " /usr/share/git/completion/git-prompt.sh"
8+ " /usr/share/git-core/contrib/completion/git-prompt.sh"
9+ " $HOME /.git-prompt.sh"
10+ )
11+
12+ __git_ps1_loaded=false
13+
14+ for f in " ${GIT_PROMPT_FILES[@]} " ; do
15+ if [ -f " $f " ]; then
16+ source " $f "
17+ __git_ps1_loaded=true
18+ break
19+ fi
20+ done
21+
22+ # なければ自動でダウンロード
23+ if [ " $__git_ps1_loaded " = false ]; then
24+ echo " git-prompt.sh が見つからないためダウンロードします..."
25+ curl -fsSL https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~ /.git-prompt.sh
26+ source ~ /.git-prompt.sh
27+ fi
28+ fi
You can’t perform that action at this time.
0 commit comments