-
Notifications
You must be signed in to change notification settings - Fork 503
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
Add source_directory()
function
#1965
Comments
Can you use modules instead of |
I'm not sure about modules:
|
I think modules are indeed the way. It's imperfect, but I decided that imports should behave as if they were included in the justfile directly, whereas modules should behave as independent justfiles, and have their recipes run in the same directory of the module source file. Modules are unstable while they're being developed, so for now the To support your use-case, we could consider adding a function to get the current directory of the source file, something like |
source_directory()
function
For information, I added a workaround by scripting commands, so it always tries to change directory to target directory from root directory.
source_directory() does give me the source directory efficiently, but what I'd like is to setup the working directory once per task. I'm not asking for this as it may be too obscure, but what I'd really like is something like that:
|
I think we should add a setting which causes imports to run in the same directory as the file. It would be pretty simple, just pass settings to |
Would that be desirable? I.e., would it be okay if there was a setting which applied to all recipes in an import, or do you just want to run some of them in the import source dir? A |
I'm not sure about the syntax, do you mean something like this on top of some imported files ?
In any case, it is certainly enough for my use-case. |
Yeah, something like that. I agree that |
Since I already highjacked this thread for |
This was done in #2088. |
Thanks ! |
Edit: Hijacking original comment for visibility.
Add a
source_directory()
function for getting the directory containing the current file, which can be used regardless of whether it is a module or import.Hello,
First, thanks for your tool, it replaced Makefile on all my projects, including those on windows platforms!
One of my just file which was working on just 1.21 is now broken.
It seems related to #1813
I understand why it was fixed, but it breaks my use-case, and seems to make the recipe attribute
no-cd
useless ?Here's a reduced test case
/tmp/justbug/justfile
/tmp/justbug/bar/bar.just
/tmp/justbug/foo/foo.just
On 1.21
It was nice, I could put some just files into dedicated directories & work directly into those directories. I could import other files and share their code. If I only wanted to share some code, I could use the no-cd attribute to make it explicit.
On latest version
Now, no-cd does nothing, the current directory is always the root directory. If you want to keep this behavior, may I suggest removing 'no-cd' and replace it with 'cd' so I could add it to the foo: command & avoid adding
cd foo
to every commands ?The text was updated successfully, but these errors were encountered: