mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 21:27:02 +01:00
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.
Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.
The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:
- 52 relative `source` lines for lib/common.sh and lib/android.sh. The
correct prefix differs per file: 40 were ../../ and 12 were ../../../,
so a blanket replace would have fixed one set and broken the other.
- REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
each walking up four levels from a directory now two levels shallower.
This caused a real regression -- the fixes suite went red with
"log_warn: command not found" -- caught by running it and comparing
against the pre-move baseline worktree.
- conftest.py's sys.path entries, which took the pytest gate down with
14 collection errors, and the `# shellcheck source=` directives, which
took shellcheck down with SC1091.
16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.
Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
229 lines
5.6 KiB
Bash
Executable File
229 lines
5.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Install Zeal - Offline Documentation Browser
|
||
# Downloads official documentation for: C, C++, JavaScript, TypeScript, Python
|
||
#
|
||
# Zeal is a free, open source (GPL) offline documentation browser
|
||
# Similar to Dash for macOS, uses compatible docsets
|
||
|
||
set -euo pipefail
|
||
|
||
# Colors for output
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
BLUE='\033[0;34m'
|
||
NC='\033[0m'
|
||
|
||
success() { echo -e "${GREEN}✓ $1${NC}"; }
|
||
warn() { echo -e "${YELLOW}⚠ $1${NC}"; }
|
||
error() { echo -e "${RED}✗ $1${NC}"; }
|
||
info() { echo -e "${BLUE}ℹ $1${NC}"; }
|
||
|
||
echo "=============================================="
|
||
echo " Offline Documentation Installer"
|
||
echo " Languages: C, C++, JavaScript, TypeScript, Python"
|
||
echo "=============================================="
|
||
echo ""
|
||
|
||
# Detect package manager and install Zeal
|
||
install_zeal() {
|
||
if command -v zeal &>/dev/null; then
|
||
success "Zeal is already installed"
|
||
return 0
|
||
fi
|
||
|
||
echo "Installing Zeal offline documentation browser..."
|
||
|
||
if command -v pacman &>/dev/null; then
|
||
# Arch Linux
|
||
sudo pacman -S --noconfirm zeal
|
||
elif command -v apt &>/dev/null; then
|
||
# Debian/Ubuntu
|
||
sudo apt update
|
||
sudo apt install -y zeal
|
||
elif command -v dnf &>/dev/null; then
|
||
# Fedora
|
||
sudo dnf install -y zeal
|
||
elif command -v zypper &>/dev/null; then
|
||
# openSUSE
|
||
sudo zypper install -y zeal
|
||
elif command -v flatpak &>/dev/null; then
|
||
# Flatpak fallback
|
||
flatpak install -y flathub org.zealdocs.Zeal
|
||
else
|
||
error "Could not detect package manager. Please install Zeal manually:"
|
||
echo " https://zealdocs.org/download.html"
|
||
return 1
|
||
fi
|
||
|
||
success "Zeal installed successfully"
|
||
}
|
||
|
||
# Get Zeal docsets directory
|
||
get_docsets_dir() {
|
||
local docsets_dir
|
||
|
||
# Check if using Flatpak
|
||
if command -v flatpak &>/dev/null && flatpak list | grep -q "org.zealdocs.Zeal"; then
|
||
docsets_dir="$HOME/.var/app/org.zealdocs.Zeal/data/Zeal/Zeal/docsets"
|
||
else
|
||
# Standard installation
|
||
docsets_dir="$HOME/.local/share/Zeal/Zeal/docsets"
|
||
fi
|
||
|
||
mkdir -p "$docsets_dir"
|
||
echo "$docsets_dir"
|
||
}
|
||
|
||
# Download a docset from Zeal feeds
|
||
download_docset() {
|
||
local name="$1"
|
||
local docsets_dir="$2"
|
||
|
||
# Check if already installed
|
||
if [ -d "$docsets_dir/${name}.docset" ]; then
|
||
warn "$name docset already installed"
|
||
return 0
|
||
fi
|
||
|
||
info "Downloading $name documentation..."
|
||
|
||
# Use Zeal's built-in feed system via CLI or direct download
|
||
# Zeal stores docsets in .docset directories
|
||
|
||
# Try to get from dash-user-contributions or official feeds
|
||
local download_url=""
|
||
|
||
case "$name" in
|
||
"C")
|
||
download_url="http://kapeli.com/feeds/C.tgz"
|
||
;;
|
||
"C++")
|
||
download_url="http://kapeli.com/feeds/C%2B%2B.tgz"
|
||
;;
|
||
"JavaScript")
|
||
download_url="http://kapeli.com/feeds/JavaScript.tgz"
|
||
;;
|
||
"TypeScript")
|
||
download_url="http://kapeli.com/feeds/TypeScript.tgz"
|
||
;;
|
||
"Python_3")
|
||
download_url="http://kapeli.com/feeds/Python_3.tgz"
|
||
;;
|
||
"Python_2")
|
||
download_url="http://kapeli.com/feeds/Python_2.tgz"
|
||
;;
|
||
"Bash")
|
||
download_url="http://kapeli.com/feeds/Bash.tgz"
|
||
;;
|
||
"HTML")
|
||
download_url="http://kapeli.com/feeds/HTML.tgz"
|
||
;;
|
||
"CSS")
|
||
download_url="http://kapeli.com/feeds/CSS.tgz"
|
||
;;
|
||
"NodeJS")
|
||
download_url="http://kapeli.com/feeds/NodeJS.tgz"
|
||
;;
|
||
"React")
|
||
download_url="http://kapeli.com/feeds/React.tgz"
|
||
;;
|
||
*)
|
||
warn "Unknown docset: $name"
|
||
return 1
|
||
;;
|
||
esac
|
||
|
||
# Download and extract
|
||
local temp_file
|
||
temp_file=$(mktemp)
|
||
|
||
echo " URL: $download_url"
|
||
if curl -fL --progress-bar "$download_url" -o "$temp_file"; then
|
||
echo " Extracting to $docsets_dir..."
|
||
tar -xzf "$temp_file" -C "$docsets_dir"
|
||
rm -f "$temp_file"
|
||
success "$name documentation downloaded"
|
||
else
|
||
rm -f "$temp_file"
|
||
warn "Failed to download $name - you can install it from Zeal's UI"
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
# Main installation
|
||
main() {
|
||
# Step 1: Install Zeal
|
||
echo ""
|
||
echo "=== Step 1: Installing Zeal ==="
|
||
install_zeal || exit 1
|
||
|
||
# Step 2: Get docsets directory
|
||
echo ""
|
||
echo "=== Step 2: Preparing docsets directory ==="
|
||
local docsets_dir
|
||
docsets_dir=$(get_docsets_dir)
|
||
success "Docsets directory: $docsets_dir"
|
||
|
||
# Step 3: Download requested docsets
|
||
echo ""
|
||
echo "=== Step 3: Downloading Documentation ==="
|
||
echo ""
|
||
|
||
# Core requested languages
|
||
local docsets=("C" "C++" "JavaScript" "TypeScript" "Python_3")
|
||
|
||
# Optional extras (comment out if not needed)
|
||
local extras=("Bash" "HTML" "CSS" "NodeJS")
|
||
|
||
# Download core docsets
|
||
for docset in "${docsets[@]}"; do
|
||
download_docset "$docset" "$docsets_dir"
|
||
done
|
||
|
||
# Ask about extras
|
||
echo ""
|
||
read -r -p "Install additional docsets (Bash, HTML, CSS, NodeJS)? [Y/n] " response
|
||
if [[ ! $response =~ ^[Nn]$ ]]; then
|
||
for docset in "${extras[@]}"; do
|
||
download_docset "$docset" "$docsets_dir"
|
||
done
|
||
fi
|
||
|
||
# Summary
|
||
echo ""
|
||
echo "=============================================="
|
||
echo " Installation Complete!"
|
||
echo "=============================================="
|
||
echo ""
|
||
echo "Installed documentation:"
|
||
for f in "$docsets_dir"/*.docset; do
|
||
if [[ -d $f ]]; then
|
||
echo " ✓ $(basename "$f" .docset)"
|
||
fi
|
||
done
|
||
echo ""
|
||
echo "Usage:"
|
||
echo " Launch Zeal from your application menu, or run: zeal"
|
||
echo ""
|
||
echo "To download additional docsets:"
|
||
echo " 1. Open Zeal"
|
||
echo " 2. Go to Tools → Docsets"
|
||
echo " 3. Click 'Available' tab and download what you need"
|
||
echo ""
|
||
echo "Keyboard shortcut tip:"
|
||
echo " Set a global hotkey in Zeal → Preferences → Global Shortcuts"
|
||
echo " (e.g., Alt+Space for quick documentation lookup)"
|
||
echo ""
|
||
echo "=============================================="
|
||
|
||
# Offer to launch Zeal
|
||
read -r -p "Launch Zeal now? [y/N] " response
|
||
if [[ $response =~ ^[Yy]$ ]]; then
|
||
nohup zeal &>/dev/null &
|
||
success "Zeal launched"
|
||
fi
|
||
}
|
||
|
||
main "$@"
|