casey / just

🤖 Just a command runner

Home Page:https://just.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation: Relative path issue with `justfile_directory()`

Splines opened this issue · comments

Here in the docs, you describe that one could run the following:

script:
  ./{{justfile_directory()}}/scripts/some_script

However, justfile_directory() gives the absolute path. Therefore, the command will fail as the path starts with .// and not ./.

There's an easy fix, just remove the prefix ./:

script:
  {{justfile_directory()}}/scripts/some_script

By the way: is there a way to always let commands be treated from the point where the root justfile sits, even from within recipes in submodules? That is, in my submodule that resides in .config/commands/, I don't want to start my commands with cd {{justfile_directory()}} all the time. Note that [no-cd] is not achieving what I mean.

TL;DR: It'd be great to have an option to treat all paths in a submodule relative to the directory containing the root .justfile.

Thanks for the report! Fixing it in #2219.

TL;DR: It'd be great to have an option to treat all paths in a submodule relative to the directory containing the root .justfile.

This would definitely be a good settting. Can you open a separate issue for it?

Awesome, thanks for the quick fix. I've opened issue #2222.