This commit is contained in:
Marc Beninca 2025-06-28 04:36:16 +02:00
parent 1cad82456e
commit 88f3ab499d
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
4 changed files with 39 additions and 24 deletions

26
sh/file.sh Normal file
View file

@ -0,0 +1,26 @@
# ╭──────╮
# │ file │
# ╰──────╯
rwx_file_append() {
local file="${1}"
local text="${2}"
if [ -n "${file}" ]; then
printf "%s" "${text}" >>"${file}"
fi
}
rwx_file_empty() {
local file="${1}"
if [ -n "${file}" ]; then
rwx_file_write "${file}" ""
fi
}
rwx_file_write() {
local file="${1}"
local text="${2}"
if [ -n "${file}" ]; then
printf "%s" "${text}" >"${file}"
fi
}

View file

@ -1,5 +1,9 @@
#! /usr/bin/env sh #! /usr/bin/env sh
# ╭──────╮
# │ main │
# ╰──────╯
# ╭──────┬───────────╮ # ╭──────┬───────────╮
# │ main │ constants │ # │ main │ constants │
# ╰──────┴───────────╯ # ╰──────┴───────────╯
@ -127,12 +131,12 @@ rwx_source() {
# run initial steps # run initial steps
rwx_main() { rwx_main() {
# system root # source system root
if ! rwx_source "${RWX_ROOT_SYSTEM}"; then if ! rwx_source "${RWX_ROOT_SYSTEM}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}" __rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1 return 1
fi fi
# user root # source user root
rwx_source "${RWX_SELF_USER}" rwx_source "${RWX_SELF_USER}"
# context / command # context / command
if [ -n "${RWX_COMMAND_NAME}" ]; then if [ -n "${RWX_COMMAND_NAME}" ]; then

View file

@ -1,3 +1,7 @@
# ╭──────╮
# │ tmux │
# ╰──────╯
# ╭──────┬───────╮ # ╭──────┬───────╮
# │ tmux │ setup │ # │ tmux │ setup │
# ╰──────┴───────╯ # ╰──────┴───────╯

View file

@ -1,25 +1,6 @@
rwx_file_append() { # ╭──────╮
local file="${1}" # │ util │
local text="${2}" # ╰──────╯
if [ -n "${file}" ]; then
printf "%s" "${text}" >>"${file}"
fi
}
rwx_file_empty() {
local file="${1}"
if [ -n "${file}" ]; then
rwx_file_write "${file}" ""
fi
}
rwx_file_write() {
local file="${1}"
local text="${2}"
if [ -n "${file}" ]; then
printf "%s" "${text}" >"${file}"
fi
}
rwx_link() { rwx_link() {
local link="${1}" local link="${1}"