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

wish: support _SUB_ROOT like sub #41

Closed
markstos opened this issue Jun 2, 2023 · 4 comments · Fixed by #46
Closed

wish: support _SUB_ROOT like sub #41

markstos opened this issue Jun 2, 2023 · 4 comments · Fixed by #46

Comments

@markstos
Copy link
Contributor

markstos commented Jun 2, 2023

One feature from sub I don't see here is that sub provides to scripts an environment variable containing the "root" directory of the project.

It's documented here in the README:
https://github.com/qrush/sub/blob/4bcb94f0c14f911fc77ac642318c5d19b359c5cd/README.md?plain=1#L58

So, if a project is named rush, an environment variable named _RUSH_ROOT would be set.

Since compatibility with sub seems to be a goal, it would be nice to support this, or document the recommended refactoring for people converting scripts.

@toumorokoshi
Copy link
Owner

Hey! I think this is reasonable. It seems like it's best as a part of the output returned by init? I was originally thinking of just exporting as part of the command-execute, but that seems more complex that it needs to be and wouldn't make the variable available outside of invocations of tome.

@markstos
Copy link
Contributor Author

markstos commented Jun 5, 2023

I would rather have it as part of command-execute, which relates to my interest in not relying on how the environment is configured (see #40). So let's resolve the conversation in #40 and then come back to this thread.

@toumorokoshi
Copy link
Owner

now that #44 is closed, I think we can talk about this issue.

I was looking at implementing it: the one thing is the variable name (e.g. _sub_root) in sub is dependent on what the command was actually called. Since tome run doesn't take in a command name, it won't be able to generate that time.

how about a constant like _TOME_SCRIPT_ROOT? I can't think of a good case off the top of my head to need to include the command name in the environment variable.

toumorokoshi added a commit that referenced this issue Sep 12, 2023
Having an environment variable that contains
the script root directory enables storing dependent scripts
in that directory.

fixes #41.
toumorokoshi added a commit that referenced this issue Sep 12, 2023
Having an environment variable that contains
the script root directory enables storing dependent scripts
in that directory.

fixes #41.
toumorokoshi added a commit that referenced this issue Sep 14, 2023
Having an environment variable that contains
the script root directory enables storing dependent scripts
in that directory.

fixes #41.
@toumorokoshi
Copy link
Owner

Fixed and shipped in https://github.com/toumorokoshi/tome/releases/tag/v0.11.0. Thanks!

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