Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Relative path issue with justfile_directory() #2217

Closed
Splines opened this issue Jul 3, 2024 · 3 comments · Fixed by #2219
Closed

Documentation: Relative path issue with justfile_directory() #2217

Splines opened this issue Jul 3, 2024 · 3 comments · Fixed by #2219

Comments

@Splines
Copy link

Splines commented Jul 3, 2024

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
@Splines
Copy link
Author

Splines commented Jul 3, 2024

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.

@casey casey linked a pull request Jul 4, 2024 that will close this issue
@casey
Copy link
Owner

casey commented Jul 4, 2024

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?

@Splines
Copy link
Author

Splines commented Jul 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants