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

Modules: add relative path support to import.file #789

Closed
wants to merge 12 commits into from

Conversation

wildum
Copy link
Contributor

@wildum wildum commented May 8, 2024

PR Description

This PR introduces an ArgScope to the loader that will be used as a parent scope when evaluating the nodes in the module. For now, it contains only one variable "module_path" that represents the current path of the module and can be used in the config. It also adds the stdlib function "path_join". Both can be used together to configure a relative path on the import.file block.

import.file “default” {
  filename = path_join(module_path, "relative/path")
}

The following use-cases are currently supported:

  • import.file in a module imported via import.file (module_path = filename of the parent import.file)
  • import.file in a module imported via import.git (module_path = path to the local cloned repo)
  • import.file in a module imported via import.string (module_path = path of the current module)

Which issue(s) this PR fixes

Fixes #786

Notes to the Reviewer

The PR can be reviewed commit by commit.

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated

wildum added 11 commits May 7, 2024 12:09
…l context to the module.

The scope has one value "module_path" that represents the dir path of the current module.
It can be used in combination with the path_join stdlib function to import modules via relative path.
- import file in import file with relative path
- import folder in import folder with relative path
- import file in import string with relative path
@wildum wildum force-pushed the modules-support-relative-path branch from 538437d to 000b538 Compare May 10, 2024 14:04
Copy link
Contributor

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@wildum
Copy link
Contributor Author

wildum commented Sep 23, 2024

I revived this PR in #1726

@wildum wildum closed this Sep 23, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modules: support relative path
1 participant