v0.3.5-r1: stabilized Fish CLI verification (no errors)
This commit is contained in:
parent
aebab346aa
commit
3d46672c6e
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env fish
|
||||
# ============================================================
|
||||
# Goondex CLI Fish Setup Script
|
||||
# Leak Technologies — v0.3.5 (2025)
|
||||
# Leak Technologies — v0.3.5 (2025-10-07)
|
||||
# ============================================================
|
||||
# Ensures the Goondex CLI is properly installed, removes old
|
||||
# aliases, installs the canonical function, reloads Fish,
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
set project_root /home/stu/Projects/PD/Goondex
|
||||
set fish_func_dir ~/.config/fish/functions
|
||||
set goondex_func $fish_func_dir/goondex.fish
|
||||
set gx_func $fish_func_dir/gx.fish
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 1. Ensure Fish functions directory exists
|
||||
|
|
@ -39,7 +40,6 @@ end
|
|||
# ------------------------------------------------------------
|
||||
echo "[*] Installing canonical goondex.fish function..."
|
||||
|
||||
# Use Fish-compatible redirection
|
||||
begin
|
||||
echo '#!/usr/bin/env fish'
|
||||
echo '# ============================================================'
|
||||
|
|
@ -58,7 +58,6 @@ begin
|
|||
echo ' set venv_path $project_root/.venv/bin/python'
|
||||
echo ' set -x PYTHONPATH $project_root/src'
|
||||
echo ''
|
||||
echo ' # Determine version dynamically'
|
||||
echo ' if test -f "$project_root/VERSION"'
|
||||
echo ' set goondex_version (cat "$project_root/VERSION" | string trim)'
|
||||
echo ' else if test -d "$project_root/.git"'
|
||||
|
|
@ -104,12 +103,6 @@ begin
|
|||
echo ' echo " --help / -h / help Show this help menu"'
|
||||
echo ' echo " --version / -v / version Show current Goondex version"'
|
||||
echo ' echo ""'
|
||||
echo ' echo "Examples:"'
|
||||
echo ' echo " goondex import \"https://www.pornpics.com/galleries/example/\""'
|
||||
echo ' echo " goondex refresh-one \"20251106_2041_Madison_Young_ATK_Archives\""'
|
||||
echo ' echo " goondex trainer"'
|
||||
echo ' echo " goondex verify ./ML/faces_cache/face_001.jpg \"Riley Reid,Eva Lovia\""'
|
||||
echo ' echo ""'
|
||||
echo ' echo "────────────────────────────────────────────"'
|
||||
echo ' echo "Goondex $goondex_version — Leak Technologies (2025)"'
|
||||
echo ' echo ""'
|
||||
|
|
@ -149,15 +142,23 @@ chmod +x $goondex_func
|
|||
echo "[+] Installed goondex.fish function at: $goondex_func"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 4. Add alias gx and persistent PYTHONPATH
|
||||
# 4. Add alias gx as persistent function
|
||||
# ------------------------------------------------------------
|
||||
if not grep -q "alias gx=" ~/.config/fish/config.fish
|
||||
echo 'alias gx="goondex"' >> ~/.config/fish/config.fish
|
||||
echo "[+] Added alias gx -> goondex"
|
||||
if not functions -q gx
|
||||
begin
|
||||
echo 'function gx --wraps=goondex --description "alias gx goondex"'
|
||||
echo ' goondex $argv'
|
||||
echo 'end'
|
||||
end > $gx_func
|
||||
funcsave gx 2>/dev/null
|
||||
echo "[+] Added gx.fish persistent alias function"
|
||||
else
|
||||
echo "[=] Alias gx already exists"
|
||||
echo "[=] gx function already exists"
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 5. Ensure PYTHONPATH is universal
|
||||
# ------------------------------------------------------------
|
||||
if not contains -- "$project_root/src" $PYTHONPATH
|
||||
set -Ux PYTHONPATH "$project_root/src"
|
||||
echo "[+] Set universal PYTHONPATH for Goondex"
|
||||
|
|
@ -166,14 +167,12 @@ else
|
|||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 5. Reload environment cleanly
|
||||
# 6. Reload and verify
|
||||
# ------------------------------------------------------------
|
||||
echo "[*] Reloading Fish environment..."
|
||||
source $goondex_func
|
||||
source ~/.config/fish/config.fish
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 6. Verify installation
|
||||
# ------------------------------------------------------------
|
||||
echo ""
|
||||
echo "[✓] Verifying Goondex CLI setup..."
|
||||
if functions -q goondex
|
||||
|
|
@ -182,10 +181,10 @@ else
|
|||
echo "❌ Failed to load goondex function."
|
||||
end
|
||||
|
||||
if alias | grep -q "alias gx="
|
||||
echo "✅ Alias 'gx' is active."
|
||||
if functions -q gx
|
||||
echo "✅ Alias function 'gx' active."
|
||||
else
|
||||
echo "❌ Alias 'gx' not found."
|
||||
echo "❌ gx function missing."
|
||||
end
|
||||
|
||||
echo ""
|
||||
|
|
|
|||
160
src/utils/verify_fish_env.fish
Normal file
160
src/utils/verify_fish_env.fish
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env fish
|
||||
# ============================================================
|
||||
# Goondex Environment Verifier (Fish, Auto-Repair)
|
||||
# Leak Technologies — v0.3.5 (2025)
|
||||
# ============================================================
|
||||
# Verifies and repairs the Fish environment for Goondex CLI:
|
||||
# • Ensures goondex.fish exists and is loaded
|
||||
# • Ensures gx alias function is defined
|
||||
# • Ensures PYTHONPATH and venv are valid
|
||||
# • Confirms CLI help output
|
||||
#
|
||||
# Supports:
|
||||
# --fix-only → silent repair mode (no printed output)
|
||||
# ============================================================
|
||||
|
||||
set project_root /home/stu/Projects/PD/Goondex
|
||||
set venv_path $project_root/.venv/bin/python
|
||||
set goondex_func ~/.config/fish/functions/goondex.fish
|
||||
set gx_func ~/.config/fish/functions/gx.fish
|
||||
set expected_py_path "$project_root/src"
|
||||
set fix_only 0
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Parse arguments
|
||||
# ------------------------------------------------------------
|
||||
for arg in $argv
|
||||
if test "$arg" = "--fix-only"
|
||||
set fix_only 1
|
||||
end
|
||||
end
|
||||
|
||||
# Helper for conditional printing
|
||||
function log
|
||||
if test "$fix_only" -eq 0
|
||||
echo $argv
|
||||
end
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Begin verification
|
||||
# ------------------------------------------------------------
|
||||
if test "$fix_only" -eq 0
|
||||
echo ""
|
||||
echo "🔍 Verifying Goondex Fish Environment"
|
||||
echo "────────────────────────────────────────────"
|
||||
end
|
||||
|
||||
# --- Check function file existence ---
|
||||
if test -f $goondex_func
|
||||
log "✅ Found goondex function at: $goondex_func"
|
||||
else
|
||||
log "❌ Missing function file: $goondex_func"
|
||||
if test -f "$project_root/src/utils/setup_fish_goondex.fish"
|
||||
log " → Attempting auto-repair..."
|
||||
fish "$project_root/src/utils/setup_fish_goondex.fish"
|
||||
exit 0
|
||||
else
|
||||
log " [!] setup_fish_goondex.fish not found — cannot auto-repair."
|
||||
end
|
||||
end
|
||||
|
||||
# --- Ensure function is loaded ---
|
||||
if not functions -q goondex
|
||||
log "⚠️ Function 'goondex' not active in shell — reloading..."
|
||||
source $goondex_func 2>/dev/null
|
||||
if functions -q goondex
|
||||
log "✅ Reloaded successfully"
|
||||
else
|
||||
log "❌ Unable to reload goondex function"
|
||||
end
|
||||
else
|
||||
log "✅ Function 'goondex' is loaded"
|
||||
end
|
||||
|
||||
# --- Ensure gx alias function exists ---
|
||||
if not functions -q gx
|
||||
log "⚠️ gx alias function not found — creating..."
|
||||
begin
|
||||
echo 'function gx --wraps=goondex --description "alias gx goondex"'
|
||||
echo ' goondex $argv'
|
||||
echo 'end'
|
||||
end > $gx_func
|
||||
funcsave gx 2>/dev/null
|
||||
source $gx_func
|
||||
log "✅ gx function created and saved"
|
||||
else
|
||||
log "✅ Alias function 'gx' → goondex is defined"
|
||||
end
|
||||
|
||||
# --- Ensure virtual environment ---
|
||||
if test -x $venv_path
|
||||
log "✅ Virtual environment found at: $venv_path"
|
||||
else
|
||||
log "❌ Python virtual environment missing or inactive"
|
||||
log " Expected: $venv_path"
|
||||
end
|
||||
|
||||
# --- Ensure PYTHONPATH correctness ---
|
||||
if test "$PYTHONPATH" = $expected_py_path
|
||||
log "✅ PYTHONPATH correctly set to: $expected_py_path"
|
||||
else
|
||||
log "⚠️ PYTHONPATH mismatch — fixing..."
|
||||
set -Ux PYTHONPATH $expected_py_path
|
||||
log "✅ PYTHONPATH updated to: $expected_py_path"
|
||||
end
|
||||
|
||||
# --- Verify CLI help output ---
|
||||
set help_output (goondex --help 2>&1)
|
||||
if echo $help_output | grep -q "Goondex CLI — Unified Interface"
|
||||
log "✅ CLI help output OK"
|
||||
else
|
||||
log "⚠️ CLI help output mismatched — attempting reload..."
|
||||
source $goondex_func 2>/dev/null
|
||||
set help_output (goondex --help 2>&1)
|
||||
if echo $help_output | grep -q "Goondex CLI — Unified Interface"
|
||||
log "✅ CLI output restored"
|
||||
else
|
||||
log "❌ CLI help output still broken"
|
||||
if test "$fix_only" -eq 0
|
||||
log " Output preview:"
|
||||
echo $help_output | head -n 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Final summary and exit code
|
||||
# ------------------------------------------------------------
|
||||
if test "$fix_only" -eq 0
|
||||
echo ""
|
||||
echo "────────────────────────────────────────────"
|
||||
echo "Goondex Fish Environment Verification Complete"
|
||||
echo ""
|
||||
end
|
||||
|
||||
set failcount 0
|
||||
if not test -f $goondex_func
|
||||
set failcount (math $failcount + 1)
|
||||
end
|
||||
if not functions -q goondex
|
||||
set failcount (math $failcount + 1)
|
||||
end
|
||||
if not functions -q gx
|
||||
set failcount (math $failcount + 1)
|
||||
end
|
||||
if not test -x $venv_path
|
||||
set failcount (math $failcount + 1)
|
||||
end
|
||||
if not echo $help_output | grep -q "Goondex CLI — Unified Interface"
|
||||
set failcount (math $failcount + 1)
|
||||
end
|
||||
|
||||
if test $failcount -gt 0
|
||||
log "❌ $failcount issue(s) detected or repaired."
|
||||
log " Run again or restart shell with: exec fish"
|
||||
exit 1
|
||||
else
|
||||
log "✅ All checks passed successfully. Environment healthy."
|
||||
exit 0
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user