#!/bin/sh # Fetches f() and fx() (plus all default sources) into a temp dir and # sources them into your CURRENT shell -- no git, no cloning. # # Run with eval so sourcing happens in your real shell, not a subshell # that vanishes when the script exits: # # eval "$(curl -fsSL https://huggingface.co/spaces/Daveswo/self-healing-autopoietic-shell/raw/main/contrib/fx/bootstrap.sh)" # # After that: f and fx are ready to use in this shell session. To keep # them in every new shell, add the same eval line to your rc file. _base="https://huggingface.co/spaces/Daveswo/self-healing-autopoietic-shell/raw/main" _dir="${TMPDIR:-/tmp}/self-healing-shell-$$" mkdir -p "$_dir/sources.d" 2>/dev/null _fetch_ok=1 curl -fsSL "$_base/src/f.sh" -o "$_dir/f.sh" || _fetch_ok=0 curl -fsSL "$_base/contrib/fx/fx.sh" -o "$_dir/fx.sh" || _fetch_ok=0 for s in 10-known.sh 20-history.sh 30-selfdiag.sh 40-pathfuzzy.sh 50-thefuck.sh 90-team-shared.sh; do curl -fsSL "$_base/contrib/fx/sources.d/$s" -o "$_dir/sources.d/$s" || _fetch_ok=0 done if [ "$_fetch_ok" != 1 ]; then echo "bootstrap: fetch failed, check your connection" >&2 else chmod +x "$_dir"/*.sh "$_dir"/sources.d/*.sh 2>/dev/null FX_SOURCES_DIR="$_dir/sources.d" export FX_SOURCES_DIR . "$_dir/f.sh" . "$_dir/fx.sh" echo "f() and fx() are ready in this shell. Try: fx " fi unset _base _dir _fetch_ok s