Compare commits

...

19 commits

Author SHA1 Message Date
a3ea2e6ef0
fix
All checks were successful
/ job (push) Successful in 4m26s
2025-07-08 07:07:11 +02:00
576d0c981c
main/cache 2025-07-08 07:03:26 +02:00
8847877290
main/source 2025-07-08 06:59:55 +02:00
be2d6b2913
fix/comments 2025-07-08 06:52:28 +02:00
cdf0f47ca3
bash/case 2025-07-08 06:39:28 +02:00
dc204d0c08
−indent 2025-07-08 06:29:16 +02:00
c8e4fc9b41
code/help 2025-07-08 06:17:21 +02:00
3dceffeea5
code/init 2025-07-08 06:09:14 +02:00
1345f07e16
main/main 2025-07-08 05:50:46 +02:00
820ec05b13
code/main 2025-07-08 05:00:09 +02:00
4f53472768
code/user 2025-07-08 04:44:46 +02:00
d9a6e33409
code/main 2025-07-08 04:35:32 +02:00
389f73a0b9
readme/tasks 2025-07-08 04:27:22 +02:00
a54f0a82f7
commands/ffmpeg,tmux 2025-07-08 03:58:17 +02:00
6332717fa3
crypt/| 2025-07-08 03:47:21 +02:00
34881bb015
main/| 2025-07-08 03:40:08 +02:00
8ff5111c0e
readme/tasks 2025-07-08 03:30:26 +02:00
07b0c3fa05
crypt 2025-07-08 02:47:38 +02:00
fd3528c3ec
crypt/setup 2025-07-08 02:27:02 +02:00
10 changed files with 127 additions and 94 deletions

View file

@ -115,7 +115,19 @@ Two interpreted languages for flexibility.
* ffmpeg
* tmux
* get unresolved path for new panes & windows
* fully working doc function algorithm
* self install aliases
* source code
* doc parsing algorithm
* install commands
* remove existing before
* test required
* binaries
* modules
* handle dependencies
* binaries
* modules
* handle tasks
* readme.md / when
* FIXME
* TODO
### 6.2 [Further tasks](#when) {#when-further}

View file

@ -6,6 +6,12 @@
# │ code │ variables │
# ╰──────┴───────────╯
# TODO variablize
# path to the entrypoint main file of the project
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
# user root directory of the project
RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}"
# cache for the parsing awk script
_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")"
# cache for code aliases
@ -21,6 +27,18 @@ _rwx_code_functions=""
# cache for code variables
_rwx_code_variables=""
# ╭──────┬──────╮
# │ code │ help │
# ╰──────┴──────╯
# output help message
rwx_code_help() {
rwx_log \
"rwx_… = functions" \
" a__… = aliases" \
" u__… = user"
}
# ╭──────┬─────────╮
# │ code │ install │
# ╰──────┴─────────╯
@ -181,3 +199,40 @@ rwx_code_parse() {
--assign action="${action}" \
"${_rwx_code_awk}"
}
# ╭──────┬──────╮
# │ code │ main │
# ╰──────┴──────╯
rwx_code_main() {
# source user root
rwx_main_source "${RWX_SELF_USER}"
# load code cache
rwx_code_load
# set command
local command
# command name used to run
# (stripped from hyphen interactive flag)
command="$(basename "${0}" | sed "s|^-||")"
case "${command}" in
"bash" | "dash" | "sh") unset command ;;
*) ;;
esac
# context / command
if [ -n "${command}" ]; then
local function
# find the matching function
function="$(rwx_code_alias_function "${command}")"
if [ -n "${function}" ]; then
"${function}" "${@}"
fi
# context / shell
else
# run interactive extras
if rwx_shell_interactive; then
# help
rwx_log
rwx_code_help
fi
fi
}

View file

@ -1,8 +1,20 @@
_rwx_cmd_cs() { rwx_crypt "${@}"; }
# ╭───────╮
# │ crypt │
# ╰───────╯
# ╭───────┬───────────╮
# │ crypt │ constants │
# ╰───────┴───────────╯
# TODO variablize
RWX_CRYPT_ROOT="/data/home/user/crypt"
RWX_CRYPT_VAR="/var/lib/crypt"
# ╭───────┬───────────╮
# │ crypt │ functions │
# ╰───────┴───────────╯
#| cat
rwx_crypt_device() {
local device size
local index=0
@ -25,7 +37,17 @@ rwx_crypt_device() {
fi
}
rwx_crypt() {
#| id
#| mkdir
#| qemu-nbd
#| cryptsetup
#| mount
#| umount
#| rmdir
#| cat
#| rm
#/ cs
rwx_crypt_setup() {
local action="${1}"
local action_close="close"
local action_open="open"

View file

@ -1,8 +1,12 @@
# ╭────────╮
# │ ffmpeg │
# ╰────────╯
# ╭────────┬─────────┬───────╮
# │ ffmpeg │ devices │ reset │
# ╰────────┴─────────┴───────╯
_rwx_cmd_rwx_ffmpeg_devices_reset() { rwx_ffmpeg_devices_reset "${@}"; }
#/ rwx_ffmpeg_devices_reset
rwx_ffmpeg_devices_reset() {
local module="uvcvideo"
modprobe --remove "${module}" &&

View file

@ -76,9 +76,9 @@ _rwx_log() {
local line
for line in "${@}"; do
if [ -n "${prefix}" ]; then
__rwx_log "${prefix} ${line}"
_rwx_main_log "${prefix} ${line}"
else
__rwx_log "${line}"
_rwx_main_log "${line}"
fi
done
}

View file

@ -3,15 +3,6 @@
# │ main │
# ╰──────╯
# main module
# * builtins
# * echo
# * printf
# * read
# * binaries
# * awk
# * cat
# * find
# * sed
# ╭──────┬───────────╮
# │ main │ constants │
@ -29,21 +20,17 @@ RWX_SELF_NAME="rwx"
# cache of all sourced code modules
_rwx_code=""
# TODO variablize
# system root directory of the project
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
# user root directory of the project
RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}"
# path to the entrypoint main file of the project
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
# ╭──────┬──────╮
# │ main │ find │
# ╰──────┴──────╯
# find directory’s files by extension
#> find
#> sort
#| find
#| sort
rwx_find_extension() {
local extension="${1}"
local root="${2}"
@ -82,7 +69,7 @@ rwx_shell_interactive() {
# │ main │ log │
# ╰──────┴─────╯
__rwx_log() {
_rwx_main_log() {
if rwx_shell_interactive; then
[ ${#} -gt 0 ] || set -- ""
local line
@ -96,24 +83,24 @@ __rwx_log() {
# │ main │ source │
# ╰──────┴────────╯
# source code from file path
rwx_source() {
# source code from root path but file
rwx_main_source() {
local root="${1}"
[ -d "${root}" ] ||
return 1
local file="${2}"
local count module modules
count=0
__rwx_log "" \
_rwx_main_log "" \
". ${root}"
modules="$(rwx_find_shell "${root}" "${file}")"
while IFS= read -r module; do
count=$((count + 1))
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}"
_rwx_main_log "$(printf "%02d" "${count}") ${module%.sh}"
# shellcheck disable=SC1090
. "${root}/${module}"
# cache code
rwx_cache "${root}" "${module}"
rwx_main_cache "${root}" "${module}"
done <<EOF
${modules}
EOF
@ -125,8 +112,8 @@ EOF
# cache source code of a module
# inside a global code variable
#> cat
rwx_cache() {
#| cat
rwx_main_cache() {
local root="${1}"
local module="${2}"
local name="${module%.sh}"
@ -145,43 +132,18 @@ ${text}
# ╰──────┴──────╯
# run initial steps
rwx_main() {
#< code
rwx_main_main() {
# cache main
rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"
rwx_main_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"
# source system root
if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
if ! rwx_main_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then
_rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1
fi
# source user root
rwx_source "${RWX_SELF_USER}"
# load code cache
rwx_code_load
# context / command
local command
# command name used to run
# (stripped from hyphen interactive flag)
command="$(basename "${0}" | sed "s|^-||")"
case "${command}" in
"bash" | "dash" | "sh") unset command ;;
*) ;;
esac
if [ -n "${command}" ]; then
local function
# find the matching function
function="$(rwx_code_alias_function "${command}")"
if [ -n "${function}" ]; then
"${function}" "${@}"
fi
# context / shell
else
rwx_self_init
fi
# run code main function
rwx_code_main "${@}"
}
# ╭──────┬─────╮
# │ main │ run │
# ╰──────┴─────╯
# run main function
rwx_main "${@}"
rwx_main_main "${@}"

View file

@ -2,35 +2,11 @@
# │ self │
# ╰──────╯
# ╭──────┬──────╮
# │ self │ help │
# ╰──────┴──────╯
# output help message
rwx_self_help() {
rwx_log \
"rwx_… = functions" \
" a__… = aliases" \
" u__… = user"
}
# ╭──────┬──────╮
# │ self │ init │
# ╰──────┴──────╯
rwx_self_init() {
# run interactive extras
if rwx_shell_interactive; then
# help
rwx_log
rwx_self_help
fi
}
# ╭──────┬────────╮
# │ self │ subset │
# ╰──────┴────────╯
# TODO move to code module
rwx_self_subset() {
local argument file root
for argument in "${@}"; do
@ -51,6 +27,7 @@ rwx_self_subset() {
# │ self │ write │
# ╰──────┴───────╯
# TODO move to code module
rwx_self_write() {
local target="${1}"
if [ -n "${target}" ]; then

View file

@ -4,8 +4,9 @@
# based on currently running shell
case "${RWX_SHELL}" in
# continue if it can handle it
"bash") ;;
# skip illegal syntax to come
# otherwise skip incorrect names to come
*) return ;;
esac

View file

@ -44,7 +44,7 @@ rwx_test_doc() {
\
"_rwx_code" \
\
"rwx_cache" \
"rwx_main_cache" \
\
"alias/batcat" \
"b" \

View file

@ -36,7 +36,7 @@ rwx_tmux_list() {
# │ tmux │ setup │
# ╰──────┴───────╯
_rwx_cmd_rwx_tmux_setup() { rwx_tmux_setup "${@}"; }
#/ rwx_tmux_setup
rwx_tmux_setup() {
local file script
if rwx_root; then