You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -941,6 +941,17 @@ $ just bar
941
941
/subdir
942
942
```
943
943
944
+
To apply the same behavior to every recipe in a module, use `set no-cd := true`.
945
+
This setting is module-local, so imported modules choose their own default, and
946
+
it can't appear alongside `set working-directory` in the same `justfile`.
947
+
Recipe-level attributes still take precedence: `[working-directory(...)]`
948
+
overrides both, and `[no-cd]` on a recipe overrides `set working-directory`.
949
+
950
+
Path resolution remains the same by default: backticks, functions like
951
+
`read()`, and shell() calls use the module's working directory even if `no-cd`
952
+
is set. To also resolve these relative to the invocation directory when
953
+
skipping `cd`, turn on `set no-cd-strict := true`.
954
+
944
955
You can override the working directory for all recipes with
945
956
`set working-directory := '…'`:
946
957
@@ -1032,6 +1043,8 @@ foo:
1032
1043
|`export`| boolean |`false`| Export all variables as environment variables. |
1033
1044
|`fallback`| boolean |`false`| Search `justfile` in parent directory if the first recipe on the command line is not found. |
1034
1045
|`ignore-comments`| boolean |`false`| Ignore recipe lines beginning with `#`. |
1046
+
|`no-cd`| boolean |`false`| Don't change directory before executing recipes and evaluating backticks, unless overridden by recipe attributes. |
1047
+
|`no-cd-strict`| boolean |`false`| When `no-cd` is set, also resolve backticks, shell functions, and path helpers relative to the invocation directory instead of the module directory. |
0 commit comments