Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ for file in $DOTFILES; do
done

echo "✅ すべてのシンボリックリンクを作成しました!"

# `git-prompt.sh`が環境になければインストール
GIT_PROMPT_INSTALL_SCRIPT="$DOTFILES_DIR/install_git-prompt.sh"

if [ -f "$GIT_PROMPT_INSTALL_SCRIPT" ]; then
echo "Running install_git-prompt.sh ..."
source "$GIT_PROMPT_INSTALL_SCRIPT"
else
echo "Error: install_git-prompt.sh が見つかりません"
exit 1
fi
30 changes: 30 additions & 0 deletions install_git-prompt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env zsh

# Git prompt (__git_ps1) のロード(自動ダウンロード対応)
if ! command -v git >/dev/null 2>&1; then
echo "Git がインストールされていません"
else
# Git の git-prompt.sh の場所候補
GIT_PROMPT_FILES=(
"/usr/share/git/completion/git-prompt.sh"
"/usr/share/git-core/contrib/completion/git-prompt.sh"
"$HOME/.git-prompt.sh"
)

__git_ps1_loaded=false

for f in "${GIT_PROMPT_FILES[@]}"; do
if [ -f "$f" ]; then
source "$f"
__git_ps1_loaded=true
break
fi
done

# なければ自動でダウンロード
if [ "$__git_ps1_loaded" = false ]; then
echo "git-prompt.sh が見つからないためダウンロードします..."
curl -fsSL https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
source ~/.git-prompt.sh
fi
fi