Ensure currently_parsed_cwd is set for config files#12338
Ensure currently_parsed_cwd is set for config files#12338fdncred merged 2 commits intonushell:mainfrom texastoland:relative-source-in-config
currently_parsed_cwd is set for config files#12338Conversation
|
I think after parsing the file, the directory should be restored back. The |
I added restoring the previous value.
I prefer any kind of abstraction vs repeating the same pattern in numerous places. 1 option could be
That said I can remove |
|
Looks good now. We can merge it after the release. I just noticed the If you want to continue improving the API, you can continue here or open a new PR, just note that there is also #12262 which changes the API significantly, and hopefully, we'll manage to land it. |
It looks to implement part of this suggestion:
Yeah IFL it supersedes this so converting to draft until I can rebase on it.
Any changes would be minimal so I'll lump them here 👌🏼 Thanks for the tips! |
|
Thanks! |
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Fixes nushell#7849, nushell#11465 based on @kubouch's suggestion in nushell#11465 (comment). # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Can source files relative to `env.nu` or `config.nu` like in nushell#6150. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Adds test that previously failed. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> Fixes nushell#7849, nushell#11465 based on @kubouch's suggestion in nushell#11465 (comment). # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Can source files relative to `env.nu` or `config.nu` like in nushell#6150. # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> Adds test that previously failed. # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
Interesting. My position is that a bad abstraction is worse than no abstraction, and repeating the same pattern a few times is OK. This is why I chose to get rid of |
Description
Fixes #7849, #11465 based on @kubouch's suggestion in #11465 (comment).
User-Facing Changes
Can source files relative to
env.nuorconfig.nulike in #6150.Tests + Formatting
Adds test that previously failed.
After Submitting