1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

make/readline (trivial): split the line containing 7 shell commands

This commit is contained in:
Nicolas Boulenguez 2019-06-02 13:18:33 +02:00
parent b3f9b5a0a3
commit 23100ede2a

View File

@ -10,6 +10,14 @@ __mal_readline_included := true
# 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}" && echo "$${line}" || echo "__||EOF||__"; history -a $(READLINE_HISTORY_FILE) 2>/dev/null || true))$(if $(filter __||EOF||__,$(__readline_temp)),$(eval READLINE_EOF := yes),$(__readline_temp))
READLINE = $(eval __readline_temp := $(shell \
history -r $(READLINE_HISTORY_FILE); \
read -u 0 -r -e -p $(if $(1),$(1),"user> ") line && \
history -s -- "$${line}" && \
echo "$${line}" || \
echo "__||EOF||__"; \
history -a $(READLINE_HISTORY_FILE) 2>/dev/null || \
true \
))$(if $(filter __||EOF||__,$(__readline_temp)),$(eval READLINE_EOF := yes),$(__readline_temp))
endif