diff --git a/bin/nux-env b/bin/nux-env index 1b6fd5c..404caf3 100755 --- a/bin/nux-env +++ b/bin/nux-env @@ -1,4 +1,4 @@ -#!/usr/bin/env nuxr-nuxsh +#!/usr/bin/env nuxsh ## Portable *nix environment by tonydamage ## diff --git a/bin/nuxr-nuxsh b/bin/nuxr-nuxsh index d617d01..f8bf4db 100755 --- a/bin/nuxr-nuxsh +++ b/bin/nuxr-nuxsh @@ -1,9 +1,10 @@ #!/usr/bin/env bash ### -### *nuxr-nuxsh* is wrapped bash interpreter for *nux-env* enhanced bash scripts -### and provides out of the box support for command-style scripts (similar in -### usage such as apt, git) with following features out of the box: +### *nuxr-nuxsh* and *nuxsh* is wrapped bash interpreter for *nux-env* enhanced +### bash scripts. +### It provides out of the box support for command-style scripts +### (similar in usage such as apt, git) with following features out of the box: ### ### task selection:: ### Automaticly selects correct tasks, displays help if @@ -25,7 +26,7 @@ ### ### ### 1. Shebang:: -### Shebang (*#!*) at the start of file is *#!/usr/bin/env nuxr-nuxsh* +### Shebang (*#!*) at the start of file is *#!/usr/bin/env nuxsh* ### 2. Tasks:: ### Script usually does only defines functions in form task {taskname} ### where taskname @@ -44,13 +45,10 @@ nux.use nuxr nux.use nux.cfg ## -## Additional commands provided by *nux-runner*: -### *nux-runner* automaticly provides following tasks to any script it executes: - +## Additional commands provided by *nuxsh*: +### *nuxsh* automaticly provides following tasks to any script it executes: ## - - ## debug:: [] ## Runs specified task with debug messages enabled. task.debug() { @@ -70,6 +68,7 @@ task.trace() { ## documentation. task.help() { nuxr.task.help "$@" + echo } ## config:: [type] name [value] @@ -158,9 +157,8 @@ if [ -n "$NUX_SCRIPT" ]; then nuxr.main "$@" else - - echo Usage: nux-runner [script] [task] [options] + echo Usage: nuxsh [script] [command] [options] echo - grep "^\#\#" "$NUX_RUNNER" | sed -re "s/^#+ ?(.*)/\1/gi" | nux.help.shelldoc + nux.help.comment "$NUX_RUNNER" echo fi diff --git a/inc/nuxr.nuxsh.sh b/inc/nuxr.nuxsh.sh index 1bdead5..5d493e8 100644 --- a/inc/nuxr.nuxsh.sh +++ b/inc/nuxr.nuxsh.sh @@ -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}\${NC_No} [\] @@ -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" \