Move from source to source-env (#6277)

* start working on source-env

* WIP

* Get most tests working, still one to go

* Fix file-relative paths; Report parser error

* Fix merge conflicts; Restore source as deprecated

* Tests: Use source-env; Remove redundant tests

* Fmt

* Respect hidden env vars

* Fix file-relative eval for source-env

* Add file-relative eval to "overlay use"

* Use FILE_PWD only in source-env and "overlay use"

* Ignore new tests for now

This will be another issue

* Throw an error if setting FILE_PWD manually

* Fix source-related test failures

* Fix nu-check to respect FILE_PWD

* Fix corrupted spans in source-env shell errors

* Fix up some references to old source

* Remove deprecation message

* Re-introduce deleted tests

Co-authored-by: kubouch <kubouch@gmail.com>
This commit is contained in:
JT
2022-09-01 08:32:56 +12:00
committed by GitHub
parent 11531b7630
commit c52d45cb97
33 changed files with 726 additions and 175 deletions

View File

@ -73,7 +73,7 @@ fn nu_lib_dirs_repl() {
let inp_lines = &[
r#"let-env NU_LIB_DIRS = [ ('scripts' | path expand) ]"#,
r#"source foo.nu"#,
r#"source-env foo.nu"#,
r#"$env.FOO"#,
];
@ -98,13 +98,13 @@ fn nu_lib_dirs_script() {
.with_files(vec![FileWithContentToBeTrimmed(
"main.nu",
r#"
source foo.nu
source-env foo.nu
"#,
)]);
let inp_lines = &[
r#"let-env NU_LIB_DIRS = [ ('scripts' | path expand) ]"#,
r#"source main.nu"#,
r#"source-env main.nu"#,
r#"$env.FOO"#,
];
@ -129,7 +129,7 @@ fn nu_lib_dirs_relative_repl() {
let inp_lines = &[
r#"let-env NU_LIB_DIRS = [ 'scripts' ]"#,
r#"source foo.nu"#,
r#"source-env foo.nu"#,
r#"$env.FOO"#,
];
@ -148,7 +148,7 @@ fn nu_lib_dirs_relative_script() {
.with_files(vec![FileWithContentToBeTrimmed(
"scripts/main.nu",
r#"
source ../foo.nu
source-env ../foo.nu
"#,
)])
.with_files(vec![FileWithContentToBeTrimmed(
@ -160,7 +160,7 @@ fn nu_lib_dirs_relative_script() {
let inp_lines = &[
r#"let-env NU_LIB_DIRS = [ 'scripts' ]"#,
r#"source scripts/main.nu"#,
r#"source-env scripts/main.nu"#,
r#"$env.FOO"#,
];