mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
Fix hiding of import patterns with globs (#487)
* Fix glob hiding * Remove docs comment
This commit is contained in:
parent
3701fd1d76
commit
930cb26e99
4 changed files with 6 additions and 11 deletions
|
@ -59,9 +59,7 @@ impl Command for Hide {
|
|||
overlay.env_vars_with_head(&import_pattern.head.name)
|
||||
} else {
|
||||
match &import_pattern.members[0] {
|
||||
ImportPatternMember::Glob { .. } => {
|
||||
overlay.env_vars_with_head(&import_pattern.head.name)
|
||||
}
|
||||
ImportPatternMember::Glob { .. } => overlay.env_vars(),
|
||||
ImportPatternMember::Name { name, span } => {
|
||||
let mut output = vec![];
|
||||
|
||||
|
|
|
@ -866,9 +866,7 @@ pub fn parse_hide(
|
|||
}
|
||||
} else {
|
||||
match &import_pattern.members[0] {
|
||||
ImportPatternMember::Glob { .. } => {
|
||||
overlay.decls_with_head(&import_pattern.head.name)
|
||||
}
|
||||
ImportPatternMember::Glob { .. } => overlay.decls(),
|
||||
ImportPatternMember::Name { name, span } => {
|
||||
let mut output = vec![];
|
||||
|
||||
|
|
|
@ -306,7 +306,6 @@ It creates the `$config` variable using the module system.
|
|||
|
||||
## Known Issues
|
||||
|
||||
* Hiding from a module needs to be improved: https://github.com/nushell/engine-q/issues/445
|
||||
* It might be more appropriate to use `$scope.modules` instead of `$scope.overlays`
|
||||
|
||||
## Future Design Ideas
|
||||
|
|
|
@ -650,7 +650,7 @@ fn hides_def_import_1() -> TestResult {
|
|||
#[test]
|
||||
fn hides_def_import_2() -> TestResult {
|
||||
fail_test(
|
||||
r#"module spam { export def foo [] { "foo" } }; use spam; hide spam *; spam foo"#,
|
||||
r#"module spam { export def foo [] { "foo" } }; use spam; hide spam; spam foo"#,
|
||||
not_found_msg(),
|
||||
)
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ fn hides_def_import_5() -> TestResult {
|
|||
#[test]
|
||||
fn hides_def_import_6() -> TestResult {
|
||||
fail_test(
|
||||
r#"module spam { export def foo [] { "foo" } }; use spam; hide spam; spam foo"#,
|
||||
r#"module spam { export def foo [] { "foo" } }; use spam *; hide spam *; foo"#,
|
||||
not_found_msg(),
|
||||
)
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ fn hides_env_import_1() -> TestResult {
|
|||
#[test]
|
||||
fn hides_env_import_2() -> TestResult {
|
||||
fail_test(
|
||||
r#"module spam { export env foo { "foo" } }; use spam; hide spam *; $nu.env.'spam foo'"#,
|
||||
r#"module spam { export env foo { "foo" } }; use spam; hide spam; $nu.env.'spam foo'"#,
|
||||
"did you mean",
|
||||
)
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ fn hides_env_import_5() -> TestResult {
|
|||
#[test]
|
||||
fn hides_env_import_6() -> TestResult {
|
||||
fail_test(
|
||||
r#"module spam { export env foo { "foo" } }; use spam; hide spam; $nu.env.'spam foo'"#,
|
||||
r#"module spam { export env foo { "foo" } }; use spam *; hide spam *; $nu.env.foo"#,
|
||||
"did you mean",
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue