-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-termpp.sh
More file actions
47 lines (39 loc) · 1.54 KB
/
install-termpp.sh
File metadata and controls
47 lines (39 loc) · 1.54 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 bash
set -e
# 1. Installiere Oh My Posh, falls noch nicht vorhanden
if ! command -v oh-my-posh &> /dev/null; then
echo "Install Oh My Posh..."
mkdir -p ~/.local/bin
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin
fi
# 2. Lade das Theme nach ~/.config/ohmyposh
mkdir -p ~/.config/ohmyposh
curl -sL https://raw.githubusercontent.com/vhstack/termpp/main/vhstack.omp.json \
-o ~/.config/ohmyposh/vhstack.omp.json
# 3. Erkenne Shell und wähle passende Konfigurationsdatei
SHELL_NAME=$(basename "$SHELL")
if [ "$SHELL_NAME" = "zsh" ]; then
RC_FILE=~/.zshrc
elif [ "$SHELL_NAME" = "bash" ]; then
RC_FILE=~/.bashrc
else
echo "⚠️ Unsupported shell: $SHELL_NAME – please configure manually."
exit 1
fi
# 4. Prüfe, ob bereits irgendein oh-my-posh-Eintrag existiert
if grep -q "oh-my-posh init" "$RC_FILE"; then
echo "ℹ️ An oh-my-posh init call was already found in $RC_FILE. Please adjust your configuration manually."
exit 0
fi
# 5. Füge die eval-Zeile nur hinzu, wenn sie noch nicht existiert
INIT_LINE='eval "$(~/.local/bin/oh-my-posh init '"$SHELL_NAME"' --config ~/.config/ohmyposh/vhstack.omp.json)"'
# 6. Konfiguriere vhstack-Theme
if ! grep -Fxq "$INIT_LINE" "$RC_FILE"; then
echo "" >> "$RC_FILE"
echo "# oh-my-posh vhstack/termpp theme" >> "$RC_FILE"
echo "$INIT_LINE" >> "$RC_FILE"
echo "✅ Oh My Posh init line has been added to $RC_FILE."
else
echo "ℹ️ Init line already present in $RC_FILE."
fi
echo "🚀 All done! Start a new $SHELL_NAME session or run 'source $RC_FILE'."