Previous: using programs, Up: using [Index]
rlwrapWhile Vicare comes with an interface to GNU Readline or
compatible library, the REPL interaction offers only very basic
editing capabilities. For this reason it is suggested to use
rlwrap:
to run Vicare’s REPL through this shell script:
#!/bin/sh
#
# Vicare Scheme GNU Readline wrapper using Rlwrap.
## Configuration variables.
vicare_PROGRAM=$(type -p vicare)
rlwrap_PROGRAM=$(type -p rlwrap)
COMPLETIONS_FILE=~/.vicare_completions
COMPLETIONS_OPTION=--file=${COMPLETIONS_FILE}
## Data variables.
# Do NOT include '\!' and '?' in this string.
BREAK_CHARS="\"#'(),;\`\\|[]{}"
## Check programs and data files existence.
function error () {
local MESSAGE=${1:?}
printf 'vie error: %s\n' "${MESSAGE}" >&2
exit 2
}
function warning () {
local MESSAGE=${1:?}
printf 'vie warning: %s\n' "${MESSAGE}" >&2
}
test -x "${rlwrap_PROGRAM}" || \
error "cannot find program 'rlwrap'"
test -x "${vicare_PROGRAM}" || \
error "cannot find program 'vicare'"
if ! test -f "${COMPLETIONS_FILE}" ; then
warning "cannot find completions file '${COMPLETIONS_FILE}'"
COMPLETIONS_OPTION=
fi
## Run.
exec "${rlwrap_PROGRAM}" \
--ansi-colour-aware \
--break-chars=${BREAK_CHARS} \
--complete-filenames \
--history-no-dupes=2 \
--multi-line \
--prompt-colour='1;31' \
--quote-characters='"' \
--remember \
${COMPLETIONS_OPTION} \
"${vicare_PROGRAM}" --raw-repl "$@"
### end of file