rc doc: Implement the -i flag of sed in a POSIX manner

This commit is contained in:
Frank LENORMAND 2017-09-29 22:16:31 +03:00
parent f26854694e
commit 18e64c5c7d

View File

@ -5,11 +5,14 @@ def -hidden -params 1..2 doc-open %{
%sh{ %sh{
manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
# Those options are handled by the `man-db` implementation # This option is handled by the `man-db` implementation
export MANWIDTH=${kak_window_width} export MANWIDTH=${kak_window_width}
if man "$1" > "${manout}"; then if man "$1" > "${manout}"; then
sed -i "" -e $(printf 's/.\x8//g') -e 's,\x1B\[[0-9;]*[a-zA-Z],,g' "${manout}" readonly manout_noescape=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
sed -e $(printf 's/.\x8//g') -e 's,\x1B\[[0-9;]*[a-zA-Z],,g' "${manout}" > "${manout_noescape}"
mv -f "${manout_noescape}" "${manout}"
printf %s\\n " printf %s\\n "
edit! -scratch '*doc*' edit! -scratch '*doc*'