Feature: Add interactive shells for Git & Tools Doktor
- Git Doktor now opens interactive shell with custom prompt - Tools Doktor opens interactive werkzeugkasten shell - Colored prompts in Crumbforest style (🌲 Git) and (🛠️ Werkzeug) - Convenient aliases (gst, gd, gl, health, check) - Stays in Crumbforest world throughout - Exit returns to main menu
This commit is contained in:
@@ -178,15 +178,32 @@ function system_doktor() {
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# TOOLS CHECK
|
||||
# TOOLS CHECK (Interactive Shell)
|
||||
# ============================================================
|
||||
|
||||
function tools_doktor() {
|
||||
clear
|
||||
echo -e "${BLUE}=== 🛠️ Werkzeug-Check ===${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}--- 🛠️ Crumbforest Werkzeugkasten ---${NC}"
|
||||
|
||||
TOOLS="jq git curl python3 nano vim"
|
||||
# Temporäres RC File für die Shell
|
||||
TOOL_RC="/tmp/crumb_tools_$$.rc"
|
||||
|
||||
cat > "${TOOL_RC}" << 'EOF'
|
||||
if [ -f /etc/bashrc ]; then source /etc/bashrc; fi
|
||||
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
|
||||
|
||||
# Farben
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Prompt im Crumbforest-Style
|
||||
export PS1="\[\033[0;33m\](🛠️ Werkzeug) \u@\h:\w$ \[\033[0m\]"
|
||||
|
||||
function tool_check() {
|
||||
echo -e "${YELLOW}=== Werkzeug-Verfügbarkeit ===${NC}"
|
||||
echo ""
|
||||
TOOLS="jq git curl wget python3 nano vim htop ncdu tree"
|
||||
|
||||
for tool in $TOOLS; do
|
||||
if command -v "$tool" &> /dev/null; then
|
||||
@@ -197,27 +214,38 @@ function tools_doktor() {
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}Mission System Requirements:${NC}"
|
||||
|
||||
# Check jq speziell (wichtig für Metadaten)
|
||||
echo -e "${YELLOW}Mission System Requirements:${NC}"
|
||||
if command -v jq &> /dev/null; then
|
||||
echo -e "${GREEN}✅ jq verfügbar${NC} - Mission Selector funktioniert"
|
||||
else
|
||||
echo -e "${RED}⚠️ jq fehlt${NC} - Bitte installieren: brew install jq (macOS) oder apt install jq (Linux)"
|
||||
echo -e "${RED}⚠️ jq fehlt${NC} - Bitte installieren!"
|
||||
fi
|
||||
}
|
||||
|
||||
echo ""
|
||||
read -p "Drücke Enter..." -r
|
||||
alias check="tool_check"
|
||||
alias logs="tail -f /var/log/syslog 2>/dev/null || tail -f /var/log/system.log 2>/dev/null || echo 'Keine Standard-Logs gefunden'"
|
||||
|
||||
echo ""
|
||||
echo "🌲 Willkommen im Crumbforest Werkzeugkasten!"
|
||||
echo ""
|
||||
echo "Befehle:"
|
||||
echo " check - Werkzeug-Verfügbarkeit prüfen"
|
||||
echo " logs - System-Logs anzeigen"
|
||||
echo " exit - Zurück zum Hauptmenü"
|
||||
echo ""
|
||||
tool_check
|
||||
EOF
|
||||
|
||||
bash --rcfile "${TOOL_RC}"
|
||||
rm -f "${TOOL_RC}"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# GIT DOKTOR
|
||||
# GIT DOKTOR (Interactive Shell)
|
||||
# ============================================================
|
||||
|
||||
function git_doktor() {
|
||||
clear
|
||||
echo -e "${BLUE}=== 🌲 Git Doktor ===${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}--- 🌲 Crumbforest Git Workstation ---${NC}"
|
||||
|
||||
if [[ ! -d ".git" ]]; then
|
||||
echo -e "${RED}❌ Kein Git Repository gefunden.${NC}"
|
||||
@@ -225,30 +253,90 @@ function git_doktor() {
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}Repository Status:${NC}"
|
||||
# Temporäres RC File für die Shell
|
||||
GIT_RC="/tmp/crumb_git_$$.rc"
|
||||
|
||||
cat > "${GIT_RC}" << 'EOF'
|
||||
if [ -f /etc/bashrc ]; then source /etc/bashrc; fi
|
||||
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
|
||||
|
||||
# Farben
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Prompt im Crumbforest-Style
|
||||
export PS1="\[\033[0;34m\](🌲 Git) \u@\h:\w$ \[\033[0m\]"
|
||||
|
||||
function check_health() {
|
||||
echo -e "${YELLOW}=== Repository Gesundheit ===${NC}"
|
||||
echo ""
|
||||
|
||||
if [ ! -d ".git" ]; then
|
||||
echo -e "${RED}❌ Kein Git Repo!${NC}"
|
||||
return
|
||||
fi
|
||||
|
||||
# Remote Info
|
||||
echo -e "${YELLOW}Remote:${NC}"
|
||||
git remote -v 2>/dev/null || echo "Keine Remotes"
|
||||
echo ""
|
||||
|
||||
# Branch Info
|
||||
echo -e "${YELLOW}Branch:${NC}"
|
||||
git branch 2>/dev/null || echo "Keine Branches"
|
||||
echo -e "${YELLOW}Current Branch:${NC}"
|
||||
git branch --show-current 2>/dev/null || git branch | grep '*'
|
||||
echo ""
|
||||
|
||||
# Sync Check
|
||||
git remote update > /dev/null 2>&1
|
||||
LOCAL=$(git rev-parse @ 2>/dev/null)
|
||||
REMOTE=$(git rev-parse @{u} 2>/dev/null)
|
||||
|
||||
if [ "$LOCAL" = "$REMOTE" ]; then
|
||||
echo -e "${GREEN}✅ Synchron mit Remote${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Nicht synchron / Push needed${NC}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Status
|
||||
echo -e "${YELLOW}Status:${NC}"
|
||||
git status --short 2>/dev/null || git status
|
||||
git status --short
|
||||
echo ""
|
||||
|
||||
# Letzter Commit
|
||||
echo -e "${YELLOW}Letzter Commit:${NC}"
|
||||
git log -1 --oneline 2>/dev/null || echo "Keine Commits"
|
||||
git log -1 --oneline --decorate 2>/dev/null
|
||||
}
|
||||
|
||||
echo ""
|
||||
read -p "Drücke Enter..." -r
|
||||
# Praktische Aliases
|
||||
alias gst="git status"
|
||||
alias gd="git diff"
|
||||
alias gl="git log --oneline --graph --decorate --all -n 10"
|
||||
alias ga="git add"
|
||||
alias gc="git commit"
|
||||
alias gp="git push"
|
||||
alias health="check_health"
|
||||
|
||||
echo ""
|
||||
echo "🌲 Willkommen in der Crumbforest Git Workstation!"
|
||||
echo ""
|
||||
echo "Befehle:"
|
||||
echo " health - Repository Gesundheit prüfen"
|
||||
echo " gst - git status"
|
||||
echo " gd - git diff"
|
||||
echo " gl - git log (graphisch)"
|
||||
echo " ga - git add"
|
||||
echo " gc - git commit"
|
||||
echo " gp - git push"
|
||||
echo " exit - Zurück zum Hauptmenü"
|
||||
echo ""
|
||||
check_health
|
||||
EOF
|
||||
|
||||
bash --rcfile "${GIT_RC}"
|
||||
rm -f "${GIT_RC}"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user