From c03f0792d8b1084c3728195b448f3052394a9dcb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 10 Jul 2025 22:43:25 +0200 Subject: [PATCH] tasks/simple --- sh/core/code.awk | 10 +++++++++- sh/core/code.sh | 10 ++++++++++ sh/main.sh | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 995174f..47ec9b1 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -28,6 +28,7 @@ BEGIN { RE_CONST = "([_A-Z][_0-9A-Z]*)" RE_SET = "=.*" RE_SPACE = "[[:space:]]" + RE_TSK = "(FIXME|TODO)" RE_VAR = "([_a-z][_0-9a-z]*)" RE_SPACES = RE_SPACE "*" @@ -42,8 +43,9 @@ BEGIN { RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END RE_FUNCTION = RE_BEGIN RE_VAR RE_FUNC RE_END - RE_MODULE = RE_BEGIN "#." RE_SPACES RE_ANY RE_END + RE_MODULE = RE_BEGIN "#\\." RE_SPACES RE_ANY RE_END RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END + RE_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END RE_VARIABLE = RE_BEGIN RE_VAR RE_SET RE_END f = "" @@ -74,6 +76,12 @@ BEGIN { if (match($0, RE_FUNCTION, m)) { print m[1] } + } else if (action == "tasks") { + if (match($0, RE_MODULE, m)) { + print ". " m[1] + } else if (match($0, RE_TASK, m)) { + print $0 + } } else if (action == "variables") { if (match($0, RE_VARIABLE, m)) { print m[1] diff --git a/sh/core/code.sh b/sh/core/code.sh index 356e757..91cf559 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -34,6 +34,8 @@ _rwx_code_commands_functions="" _rwx_code_constants="" # cache for code functions _rwx_code_functions="" +# cache for code tasks +_rwx_code_tasks="" # cache for code variables _rwx_code_variables="" @@ -175,6 +177,12 @@ rwx_code_modules_user() { echo "${rwx_code_modules_user}" } +# show the cached tasks +#= rct +rwx_code_tasks() { + echo "${_rwx_code_tasks}" +} + # show the cached variables #= rcv rwx_code_variables() { @@ -233,6 +241,8 @@ EOF _rwx_code_constants="$(rwx_code_parse "constants")" # parse functions _rwx_code_functions="$(rwx_code_parse "functions")" + # parse tasks + _rwx_code_tasks="$(rwx_code_parse "tasks")" # parse variables _rwx_code_variables="$(rwx_code_parse "variables")" } diff --git a/sh/main.sh b/sh/main.sh index f14f6e7..d3f9ccf 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -32,6 +32,7 @@ rwx_main_path="${rwx_main_root}/${rwx_main_file}" # │ main │ find │ # ╰──────┴──────╯ +# FIXME separate in two functions # find root directory shell modules #| find #| sed