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

set working-directory := justfile_directory() #2333

Closed
anacrolix opened this issue Aug 30, 2024 · 5 comments
Closed

set working-directory := justfile_directory() #2333

anacrolix opened this issue Aug 30, 2024 · 5 comments

Comments

@anacrolix
Copy link

I can't seem to set the working directory to remain unchanged.

Essentially I want [no-cd] to be the default everywhere.

Previously I've achieved this using a shebang with #!/usr/bin/env -S just --working-directory . --justfile but this doesn't work if I just invoke just in a directory, rather than execute the justfile directly.

> just -l
error: Expected keyword `x` but found identifier `justfile_directory`
 ——▶ justfile:2:26
  │
2 │ set working-directory := justfile_directory()
  │                          ^^^^^^^^^^^^^^^^^^
@nogweii
Copy link

nogweii commented Aug 30, 2024

See #2291 and #2082 for solving this.

@casey casey closed this as completed Aug 30, 2024
@anacrolix
Copy link
Author

Neither solves the case that you can't set the working directory programmatically for the whole file. You can already set it statically, so it seems odd.

@casey
Copy link
Owner

casey commented Aug 31, 2024

@anacrolix Yah, this is an unfortunate limitation of how evaluation works. Expressions can run commands, access files, and read environment variables, so how they execute depends on settings, so the value of settings can't be arbitrary expressions. The ultimate solution is probably to allow only expressions which don't depend on settings in setting values, see #2309, but that's a big change.

@anacrolix
Copy link
Author

Thanks! And thanks for the effort on the great project.

@casey
Copy link
Owner

casey commented Sep 1, 2024

Of course! Thank you for the kind words ^_^

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

No branches or pull requests

3 participants