From c3d75dacd61c494eeadcf9b9a74b992c748dacef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 25 Aug 2024 22:42:37 +0200 Subject: [PATCH] spcd_os_cat --- spcd/main.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spcd/main.sh b/spcd/main.sh index f641e65..f4a93e6 100644 --- a/spcd/main.sh +++ b/spcd/main.sh @@ -172,6 +172,11 @@ spcd_frame_shut() { echo "${SPCD_FRAME_UP_AND_RIGHT}${1}" } +# ╭──────────┬────╮ +# │ internal │ os │ +# ╰──────────┴────╯ + + # ╭──────────┬──────╮ # │ internal │ rule │ # ╰──────────┴──────╯ @@ -1144,7 +1149,7 @@ ${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}" # │ functions │ # ╰───────────╯ -spcd_cat() { +spcd_os_cat() { spcd_cat__file="${1}" if [ -n "${spcd_cat__file}" ]; then spcd_frame_open "${spcd_cat__file}" @@ -1204,10 +1209,10 @@ spcd_sed() { spcd_sed__file="${1}" shift if [ -f "${spcd_sed__file}" ]; then - spcd_cat "${spcd_sed__file}" + spcd_os_cat "${spcd_sed__file}" for spcd_sed__regex in "${@}"; do sed --in-place "s${spcd_sed__regex}g" "${spcd_sed__file}" && - spcd_cat "${spcd_sed__file}" || exit + spcd_os_cat "${spcd_sed__file}" || exit done fi } @@ -1216,10 +1221,10 @@ spcd_write() { spcd_write__file="${1}" spcd_write__text="${2}" if [ -n "${spcd_write__file}" ]; then - [ -f "${spcd_write__file}" ] && spcd_cat "${spcd_write__file}" + [ -f "${spcd_write__file}" ] && spcd_os_cat "${spcd_write__file}" echo "→ ${spcd_write__file}" printf "%s" "${spcd_write__text}" >"${spcd_write__file}" || exit - spcd_cat "${spcd_write__file}" + spcd_os_cat "${spcd_write__file}" fi }