blob: e6b6eee8853ef8d3d35802cbcf674cb7421433a9 (
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
|
# Our ~/.profile should already have made a directory with the supported
# options for us; if not, we won't be wrapping ed(1) with a function at all
[ -d "$HOME"/.cache/sh/opt/ed ] || return
# 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/sh/opt/ed/verbose ] &&
set -- --verbose "$@"
# Add an asterisk prompt (POSIX feature)
set -- -p\* "$@"
# 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 "$@"
}
|