diff options
author | EuAndreh <eu@euandre.org> | 2023-07-07 19:17:31 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-07-07 19:17:31 -0300 |
commit | 4514a8dc9b66c79073bf3942440d59b02f8f082c (patch) | |
tree | d95734cd9134b3c6fbf685c93050e467a6efa905 /bin/li | |
parent | etc/sh/rc: Add rlwrap alias for li(1) (diff) | |
download | dotfiles-4514a8dc9b66c79073bf3942440d59b02f8f082c.tar.gz dotfiles-4514a8dc9b66c79073bf3942440d59b02f8f082c.tar.xz |
bin/{cl,li}: Use executables from WIP standalone package
Diffstat (limited to 'bin/li')
-rwxr-xr-x | bin/li | 107 |
1 files changed, 0 insertions, 107 deletions
@@ -1,107 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - li [-I IMPL ] [-v] [OPTIONS...] - li -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -I IMPL use the given implementation (default: $LISP_CLI_IMPL) - -v verbose mode - -h, --help show this message - - OPTIONS options to be forwarded to cl(1) (lisp-cli) - - - Run the cl(1) executable with OPTIONS, but make sure an up-to-date - image exists and load it. - - - Examples: - - Launch a REPL from an image: - - $ li - - - Give options to cl(1): - - $ li -I sbcl -e '(print 123)' - EOF -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -VERBOSE=false -IMPL="${LISP_CLI_IMPL:-clisp}" -while getopts ':I:vh' flag; do - case "$flag" in - I) - IMPL="$OPTARG" - ;; - v) - VERBOSE=true - ;; - h) - usage - help - exit - ;; - *) - ;; - esac -done -if [ "${1:-}" = '--' ]; then - shift -fi - - -IMAGE="${XDG_DATA_HOME:-$HOME/.local/share}/lisp-cli/$IMPL.image" -BIN="$(command -v cl)" -INIT="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" - -mkdir -p "$(dirname "$IMAGE")" - -if [ ! -e "$IMAGE" ]; then - printf 'Bootstrapping a new "%s" image...\n' "$IMPL" >&2 - cl \ - -I "$IMPL" \ - -v \ - -e '(ql:quickload :trivial-dump-core)' \ - -E "(trivial-dump-core:dump-image \"$IMAGE\")" -elif [ -n "$(find "$0" "$BIN" "$INIT" -newer "$IMAGE")" ]; then - printf 'Refresh existing "%s" image...\n' "$IMPL" >&2 - cl \ - -M "$IMAGE" \ - -I "$IMPL" \ - -v \ - -e '(ql:quickload :trivial-dump-core)' \ - -E "(trivial-dump-core:dump-image \"$IMAGE\")" -fi - -if [ "$VERBOSE" = true ]; then - set -x -fi -exec cl -M "$IMAGE" "$@" |