1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Fixed help generation

This commit is contained in:
Tony Tkáčik 2024-03-28 12:10:57 +01:00
parent d3ca4e1b9a
commit a8f9415ba1
3 changed files with 13 additions and 15 deletions

View file

@ -1,5 +1,6 @@
nux.use nux/color
nux.use nuxr/repl
nux.use nux/help
@prefix check nux.check.
@prefix help nux.help.
@ -50,7 +51,6 @@ nux.use nuxr/repl
@namespace nuxr.task.help. {
function : {
nux.use nux/help
allArgs="$@"
if [ -z "$allArgs" ] {
echo Usage: $NC_Bold$NUX_SCRIPTNAME ${NC_No}${NC_White}\<command\>${NC_No} [\<options\>]
@ -85,7 +85,7 @@ nux.use nuxr/repl
local task_dot=$(tr " " "." <<< "$task")
nux.log trace "Trying to figure task documentation location for $task $task_dot"
doc_start=$(grep -hn -E "## +($task)::" "$script" | cut -d: -f1)
code_start=$(grep -hn -E "((@command +:?$task_dot)|(function +task.$task_dot)|(task.$task_dot *\(\))) +{" "$script" | cut -d: -f1)
code_start=$(grep -hn -E "(@command +:?$task_dot)|(function +task.$task_dot)|(task.$task_dot *\(\) +{)" "$script" | cut -d: -f1)
nux.log trace "doc_start" $doc_start $code_start
if [ -n "$doc_start" -a -n "$code_start" ] {
sed -n "$doc_start,$code_start"p "$script" \