Skip to content

Commit

Permalink
Merge branch 'master' into invertable-attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
neunenak authored Dec 22, 2024
2 parents 148542b + 6a2edd9 commit 7d30976
Showing 1 changed file with 49 additions and 9 deletions.
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1903,14 +1903,20 @@ for details.
@echo '{{ style("error") }}OH NO{{ NORMAL }}'
```

##### XDG Directories<sup>1.23.0</sup>
##### User Directories<sup>1.23.0</sup>

These functions return paths to user-specific directories for things like
configuration, data, caches, executables, and the user's home directory. These
functions follow the
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html),
and are implemented with the
[`dirs`](https://docs.rs/dirs/latest/dirs/index.html) crate.
configuration, data, caches, executables, and the user's home directory.

On Unix, these functions follow the
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

On MacOS and Windows, these functions return the system-specified user-specific
directories. For example, `cache_directory()` returns `~/Library/Caches` on
MacOS and `{FOLDERID_LocalAppData}` on Windows.

See the [`dirs`](https://docs.rs/dirs/latest/dirs/index.html) crate for more
details.

- `cache_directory()` - The user-specific cache directory.
- `config_directory()` - The user-specific configuration directory.
Expand All @@ -1920,6 +1926,10 @@ and are implemented with the
- `executable_directory()` - The user-specific executable directory.
- `home_directory()` - The user's home directory.

If you would like to use XDG base directories on all platforms you can use the
`env(…)` function with the appropriate environment variable, e.g.,
`env('XDG_CACHE_HOME')`.

### Constants

A number of constants are predefined:
Expand Down Expand Up @@ -3482,9 +3492,39 @@ and recipes defined after the `import` statement.
Imported files can themselves contain `import`s, which are processed
recursively.

When `allow-duplicate-recipes` is set, recipes in parent modules override
recipes in imports. In a similar manner, when `allow-duplicate-variables` is
set, variables in parent modules override variables in imports.
`allow-duplicate-recipes` and `allow-duplicate-variables` allow duplicate
recipes and variables, respectively, to override each other, instead of
producing an error.

Within a module, later definitions override earlier definitions:

```just
set allow-duplicate-recipes
foo:
foo:
echo 'yes'
```

When `import`s are involved, things unfortunately get much more complicated and
hard to explain.

Shallower definitions always override deeper definitions, so recipes at the top
level will override recipes in imports, and recipes in an import will override
recipes in an import which itself imports those recipes.

When two duplicate definitions are imported and are at the same depth, the one
from the earlier import will override the one from the later import.

This is because `just` uses a stack when processing imports, pushing imports
onto the stack in source-order, and always processing the top of the stack
next, so earlier imports are actually handled later by the compiler.

This is definitely a bug, but since `just` has very strong backwards
compatibility guarantees and we take enormous pains not to break anyone's
`justfile`, we have created issue #2540 to discuss whether or not we can
actually fix it.

Imports may be made optional by putting a `?` after the `import` keyword:

Expand Down

0 comments on commit 7d30976

Please sign in to comment.