diff --git a/README.md b/README.md index 8bb584f..23c2e02 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ Example: ### @goal -Syntax #1: +#### Simple goal ``` @goal goal_name [ @private ] ``` @@ -254,7 +254,7 @@ Invoking `./makesure` without arguments will attempt to call the goal named `def echo "I'm default goal" ``` -Syntax #2: +#### Glob goal ``` @goal [ goal_name ] @glob [ @private ] ``` @@ -320,16 +320,16 @@ to be able to run each test individually (`./makesure test2.js` for example) and In case if you need to glob the files with spaces in their names, please check the [naming rules section](#naming-rules) below. -### Parameterized goals +#### Parameterized goal Make code easier to reuse. Declaration syntax (using `@params`): -```shell +```sh @goal goal_name @params A B C ``` Usage syntax (using `@args`): -```shell +```sh @goal other_goal @params PARAM @depends_on goal_name @args 'value1' 'value 2' PARAM ``` @@ -338,7 +338,7 @@ The idea of using two complementary keywords `@params` + `@args` was inspired by Example: -```shell +```sh @goal file_downloaded @params FILE_NAME echo "Downloading $FILE_NAME..." @@ -397,7 +397,7 @@ Note, the goal's body parameter values will appear as environment variables (as Note, you can reference the `@define`-ed variables in the arguments of the parameterized goals: -```shell +```sh @define HELLO 'hello' @goal parameterized_goal @params ARG @@ -425,6 +425,45 @@ Please find a more real-world example [here](https://github.com/xonixx/fhtagn/bl For more technical consideration regarding this feature see [parameterized_goals.md](docs/parameterized_goals.md). +#### Naming rules + +It's *recommended* that you name your goals using alphanumeric chars + underscore. + +However, it's possible to name a goal any way you want provided that you apply proper escaping: + +```sh +@goal 'name with spaces' # all chars between '' have literal meaning, same as in shell, ' itself is not allowed in it + +@goal $'name that contains \' single quote' # if you need to have ' in a string, use dollar-strings and escape it + +@goal usual_name +``` + +Now `./makesure -l` gives: +``` +Available goals: + 'name with spaces' + $'name that contains \' single quote' + usual_name +``` + +Note, how goal names are already escaped in output. This is to make it easier for you to call it directly: +```sh +./makesure $'name that contains \' single quote' +``` + +Same naming rules apply to other directives (like `@doc`). + +Usually you won't need this escaping tricks often, but they can be especially in use for `@glob` goals if the relevant files have spaces in them: + +```sh +@goal @glob 'file\ with\ spaces*.txt' +@goal other + @depends_on 'file with spaces1.txt' +``` + +More info on this topic is covered in the [issue](https://github.com/xonixx/makesure/issues/63). + ### @doc Only valid: inside `@goal`. @@ -614,49 +653,10 @@ Only valid: inside `@goal`. Only single `@use_lib` per goal is allowed. -### Naming rules - -It's *recommended* that you name your goals using alphanumeric chars + underscore. - -However, it's possible to name a goal any way you want provided that you apply proper escaping: - -```sh -@goal 'name with spaces' # all chars between '' have literal meaning, same as in shell, ' itself is not allowed in it - -@goal $'name that contains \' single quote' # if you need to have ' in a string, use dollar-strings and escape it - -@goal usual_name -``` - -Now `./makesure -l` gives: -``` -Available goals: - 'name with spaces' - $'name that contains \' single quote' - usual_name -``` - -Note, how goal names are already escaped in output. This is to make it easier for you to call it directly: -```sh -./makesure $'name that contains \' single quote' -``` - -Same naming rules apply to other directives (like `@doc`). - -Usually you won't need this escaping tricks often, but they can be especially in use for `@glob` goals if the relevant files have spaces in them: - -```sh -@goal @glob 'file\ with\ spaces*.txt' -@goal other - @depends_on 'file with spaces1.txt' -``` - -More info on this topic is covered in the [issue](https://github.com/xonixx/makesure/issues/63). - ## Bash completion Install Bash completion for `./makesure` locally -```shell +```sh [[ ! -f ~/.bash_completion ]] && touch ~/.bash_completion grep makesure ~/.bash_completion >/dev/null || echo '. ~/.makesure_completion.bash' >> ~/.bash_completion curl "https://raw.githubusercontent.com/xonixx/makesure/main/completion.bash?token=$(date +%s)" -o ~/.makesure_completion.bash diff --git a/mdbooker.awk b/mdbooker.awk index 310b002..b4eff63 100644 --- a/mdbooker.awk +++ b/mdbooker.awk @@ -11,7 +11,8 @@ BEGIN { /^# / { handleTitle(1); next } /^## / { handleTitle(2); next } /^### / { handleTitle(3); next } -/^#### / { print "error: ####"; exit 1 } +/^#### / { handleTitle(4); next } +/^#####/ { print "error: #####"; exit 1 } { Content = Content $0 "\n"; next } function handleTitle(h, md,indent,dir,i,path) {