Update Indentation Documentation (#1600)
This commit is contained in:
parent
992c6943da
commit
7e5bac66ae
38
README.md
38
README.md
@ -1918,7 +1918,43 @@ foo:
|
|||||||
|
|
||||||
### Indentation
|
### Indentation
|
||||||
|
|
||||||
Recipe lines can be indented with spaces or tabs, but not a mix of both. All of a recipe's lines must have the same indentation, but different recipes in the same `justfile` may use different indentation.
|
Recipe lines can be indented with spaces or tabs, but not a mix of both. All of a recipe's lines must have the same type of indentation, but different recipes in the same `justfile` may use different indentation.
|
||||||
|
|
||||||
|
Each recipe must be indented at least one level from the `recipe-name` but after that may be further indented.
|
||||||
|
|
||||||
|
Here's a justfile with a recipe indented with spaces, represented as `·`, and tabs, represented as `→`.
|
||||||
|
|
||||||
|
```justfile
|
||||||
|
set windows-shell := ["pwsh", "-NoLogo", "-NoProfileLoadTime", "-Command"]
|
||||||
|
|
||||||
|
set ignore-comments
|
||||||
|
|
||||||
|
list-space directory:
|
||||||
|
··#!pwsh
|
||||||
|
··foreach ($item in $(Get-ChildItem {{directory}} )) {
|
||||||
|
····echo $item.Name
|
||||||
|
··}
|
||||||
|
··echo ""
|
||||||
|
|
||||||
|
# indentation nesting works even when newlines are escaped
|
||||||
|
list-tab directory:
|
||||||
|
→ @foreach ($item in $(Get-ChildItem {{directory}} )) { \
|
||||||
|
→ → echo $item.Name \
|
||||||
|
→ }
|
||||||
|
→ @echo ""
|
||||||
|
```
|
||||||
|
|
||||||
|
```pwsh
|
||||||
|
PS > just list-space ~
|
||||||
|
Desktop
|
||||||
|
Documents
|
||||||
|
Downloads
|
||||||
|
|
||||||
|
PS > just list-tab ~
|
||||||
|
Desktop
|
||||||
|
Documents
|
||||||
|
Downloads
|
||||||
|
```
|
||||||
|
|
||||||
### Multi-Line Constructs
|
### Multi-Line Constructs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user