From 26527d5d9924c26967995393360e54ada6e69c18 Mon Sep 17 00:00:00 2001 From: laniakea64 Date: Sat, 2 Dec 2023 19:59:54 -0500 Subject: [PATCH] Document line continuations (#1751) --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/README.md b/README.md index d070567..3b0bc5d 100644 --- a/README.md +++ b/README.md @@ -2076,6 +2076,64 @@ while: done ``` +#### Outside Recipe Bodies + +Parenthesized expressions can span multiple lines: + +```just +abc := ('a' + + 'b' + + 'c') + +abc2 := ( + 'a' + + 'b' + + 'c' +) + +foo param=('foo' + + 'bar' + ): + echo {{param}} + +bar: (foo + 'Foo' + ) + echo 'Bar!' +``` + +Lines ending with a backslash continue on to the next line as if the lines were joined by whitespace1.15.0: + +```just +a := 'foo' + \ + 'bar' + +foo param1 \ + param2='foo' \ + *varparam='': dep1 \ + (dep2 'foo') + echo {{param1}} {{param2}} {{varparam}} + +dep1: \ + # this comment is not part of the recipe body + echo 'dep1' + +dep2 \ + param: + echo 'Dependency with parameter {{param}}' +``` + +Backslash line continuations can also be used in interpolations. The line following the backslash must start with the same indentation as the recipe body, although additional indentation is accepted. + +```just +recipe: + echo '{{ \ + "This interpolation " + \ + "has a lot of text." \ + }}' + echo 'back to recipe body' +``` + ### Command Line Options `just` supports a number of useful command line options for listing, dumping, and debugging recipes and variables: