blob: 1208f5c2a5a40c7392740bdee22f957d008a5085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#
# mal (Make Lisp) shell readline wrapper
#
ifndef __mal_readline_included
__mal_readline_included := true
# Call bash read/readline. Since each call is in a separate shell
# instance we need to restore and save after each call in order to
# have readline history.
READLINE_EOF :=
READLINE_HISTORY_FILE := $${HOME}/.mal-history
READLINE = $(eval __readline_temp := $(shell history -r $(READLINE_HISTORY_FILE); read -u 0 -r -e -p $(if $(1),$(1),"user> ") line && history -s -- "$${line}" && history -a $(READLINE_HISTORY_FILE) && echo "$${line}" || echo "__||EOF||__"))$(if $(filter __||EOF||__,$(__readline_temp)),$(eval READLINE_EOF := yes),$(__readline_temp))
endif
|