Overhaul help system UX with navi, recipes, and onboarding

- Rewrite fhelp: add 'start' onboarding, recipe fallback chain
  (our files → cheat → tldr), 'workflow' dynamic loader, tier badges
- Add welcome.sh: unified English welcome for bash/zsh/fish
- Replace German README with concise English version
- Add Zsh F1/Ctrl+/ widget for inline help while typing
- Configure navi Ctrl+G widget for interactive cheatsheet browsing
- Fix dangerous 'alias help=fhelp' (was breaking bash builtin)
- Add 'h' and 'analyse' as safe aliases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tobias
2026-03-28 17:38:37 +01:00
parent f3ccc09c3d
commit 3a8e5d90ef
5 changed files with 423 additions and 233 deletions
+47 -37
View File
@@ -9,12 +9,12 @@ if [[ ! -d "$HOME" ]] || [[ ! -w "$HOME" ]]; then
HISTFILE=/tmp/.zsh_history_$$
HISTSIZE=10000
SAVEHIST=10000
autoload -Uz compinit && compinit -d /tmp/.zcompdump_$$
autoload -U colors && colors
PROMPT='%F{red}[🔍]%f %F{cyan}%~%f $ '
PROMPT='%F{red}[>]%f %F{cyan}%~%f $ '
# Load plugins if available
[[ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && \
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
@@ -23,7 +23,7 @@ if [[ ! -d "$HOME" ]] || [[ ! -w "$HOME" ]]; then
else
# Oh My Zsh setup for regular users
export ZSH="$HOME/.oh-my-zsh"
# Install Oh My Zsh if not present
if [[ ! -d "$ZSH" ]]; then
echo "Installing Oh My Zsh..."
@@ -32,25 +32,21 @@ else
RUNZSH=no CHSH=no sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 2>/dev/null
}
fi
# Oh My Zsh theme - using agnoster-like theme for security work
# Oh My Zsh theme
ZSH_THEME="robbyrussell"
# Custom theme for file analysis work
if [[ -d "$ZSH" ]]; then
# Plugins to load
plugins=(git docker command-not-found colored-man-pages)
# Load Oh My Zsh
source $ZSH/oh-my-zsh.sh 2>/dev/null || true
# Custom prompt with analysis indicator
PROMPT='%F{red}🔍%f %F{cyan}%~%f $(git_prompt_info)%# '
PROMPT='%F{red}>%f %F{cyan}%~%f $(git_prompt_info)%# '
RPROMPT='%F{yellow}%*%f'
else
# Fallback if OMZ installation failed
autoload -U colors && colors
PROMPT='%F{red}[🔍]%f %F{cyan}%~%f $ '
PROMPT='%F{red}[>]%f %F{cyan}%~%f $ '
fi
fi
@@ -89,7 +85,7 @@ setopt AUTO_MENU
[[ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && \
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Aliases for file analysis
# Standard aliases
alias ls='ls --color=auto'
alias ll='ls -lah'
alias la='ls -A'
@@ -100,12 +96,12 @@ alias egrep='egrep --color=auto'
# Tool aliases
alias fd='fdfind'
alias bat='batcat' # Ubuntu names it batcat
alias bat='batcat'
alias rg='rg --color=auto'
alias analyse='fhelp'
alias help='fhelp'
# Help alias (? needs special handling in zsh)
# Help system aliases (note: 'help' intentionally NOT aliased — preserves bash builtin)
alias analyse='fhelp'
alias h='fhelp'
if [[ -n "$ZSH_VERSION" ]]; then
alias \?='fhelp'
else
@@ -135,21 +131,35 @@ fi
export EDITOR=vim
export VISUAL=vim
# Welcome message (only on interactive shells)
if [[ -o interactive ]] && [[ -f /opt/README ]]; then
# Only show welcome once per session
if [[ -z "$_WELCOME_SHOWN" ]]; then
echo ""
echo "\033[1;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
echo "\033[1;31m File Analysis Container\033[0m \033[1;33m(zsh with Oh My Zsh)\033[0m"
echo "\033[1;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
echo ""
echo " \033[1;32mfhelp\033[0m or \033[1;32m?\033[0m - Help system"
echo " \033[1;32mfhelp cheat <tool>\033[0m - Quick examples"
echo " \033[1;32mfhelp tools pdf\033[0m - Find PDF tools"
echo ""
echo " Shells: \033[0;36mbash\033[0m (default), \033[0;36mzsh\033[0m (current), \033[0;36mfish\033[0m"
echo ""
export _WELCOME_SHOWN=1
fi
# ============================================================
# Navi interactive cheatsheet widget (Ctrl+G)
# ============================================================
if command -v navi &>/dev/null; then
eval "$(navi widget zsh)" 2>/dev/null
fi
# ============================================================
# F1 / Ctrl+H: Show help for the command being typed
# ============================================================
_fhelp_inline_widget() {
local cmd="${BUFFER%% *}"
if [[ -n "$cmd" ]]; then
zle -I
echo ""
fhelp cheat "$cmd" 2>/dev/null || fhelp tools "$cmd" 2>/dev/null || echo "No help for: $cmd"
echo ""
zle reset-prompt
zle redisplay
fi
}
zle -N _fhelp_inline_widget
bindkey '\eOP' _fhelp_inline_widget # F1
bindkey '\e[11~' _fhelp_inline_widget # F1 (alternate escape)
bindkey '^_' _fhelp_inline_widget # Ctrl+/ (universal fallback)
# ============================================================
# Welcome message (login shells only)
# ============================================================
if [[ -o interactive && -o login ]] || [[ -o interactive && -z "$_WELCOME_SHOWN" ]]; then
[[ -f /usr/local/bin/welcome.sh ]] && source /usr/local/bin/welcome.sh
fi