blob: 3e544c74a4ae0694b69d957435d9b44ec063f99c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# Define function proper
ed() {
# Don't mess with original call if input not a terminal
if ! [ -t 0 ] ; then
command ed "$@"
return
fi
# Add --verbose to explain errors
[ -e "$HOME"/.cache/ed/verbose ] &&
set -- --verbose "$@"
# Add an asterisk prompt (POSIX feature); color it dark green if we can
set -- -p "$(
if [ "$(tput colors || tput Co)" -gt 8 ] ; then
ec=${ED_PROMPT_COLOR:-2}
tput setaf "$ec" ||
tput setaf "$ec" 0 0 ||
tput AF "$ec" ||
tput AF "$ec" 0 0
printf %s "${ED_PROMPT:-'*'}"
tput sgr0 || tput me
else
printf %s "${ED_PROMPT:-'*'}"
fi 2>/dev/null
)" "$@"
# Run in rlwrap(1) if available
set -- ed "$@"
command -v rlwrap >/dev/null 2>&1 &&
set -- rlwrap --history-filename=/dev/null "$@"
# Run determined command
command "$@"
}
|