spcd_os_cat
This commit is contained in:
parent
b52842db6f
commit
c3d75dacd6
1 changed files with 10 additions and 5 deletions
15
spcd/main.sh
15
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue