mirror of
https://github.com/nushell/nushell.git
synced 2024-11-28 11:24:09 +01:00
Rename overlay commands (#6375)
* rename from overlay add to overlay use * rename from overlay remove to overlay hide * rename add to use_
This commit is contained in:
parent
c5ca839294
commit
9c4bbe3c63
@ -4,20 +4,20 @@ use nu_protocol::engine::{Command, EngineState, Stack};
|
|||||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape};
|
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct OverlayRemove;
|
pub struct OverlayHide;
|
||||||
|
|
||||||
impl Command for OverlayRemove {
|
impl Command for OverlayHide {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"overlay remove"
|
"overlay hide"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
"Remove an active overlay"
|
"Hide an active overlay"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("overlay remove")
|
Signature::build("overlay hide")
|
||||||
.optional("name", SyntaxShape::String, "Overlay to remove")
|
.optional("name", SyntaxShape::String, "Overlay to hide")
|
||||||
.switch(
|
.switch(
|
||||||
"keep-custom",
|
"keep-custom",
|
||||||
"Keep all newly added symbols within the next activated overlay",
|
"Keep all newly added symbols within the next activated overlay",
|
||||||
@ -26,7 +26,7 @@ impl Command for OverlayRemove {
|
|||||||
.named(
|
.named(
|
||||||
"keep-env",
|
"keep-env",
|
||||||
SyntaxShape::List(Box::new(SyntaxShape::String)),
|
SyntaxShape::List(Box::new(SyntaxShape::String)),
|
||||||
"List of environment variables to keep from the removed overlay",
|
"List of environment variables to keep from the hidden overlay",
|
||||||
Some('e'),
|
Some('e'),
|
||||||
)
|
)
|
||||||
.category(Category::Core)
|
.category(Category::Core)
|
||||||
@ -110,31 +110,31 @@ impl Command for OverlayRemove {
|
|||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "Remove an overlay created from a module",
|
description: "Hide an overlay created from a module",
|
||||||
example: r#"module spam { export def foo [] { "foo" } }
|
example: r#"module spam { export def foo [] { "foo" } }
|
||||||
overlay add spam
|
overlay use spam
|
||||||
overlay remove spam"#,
|
overlay hide spam"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Remove an overlay created from a file",
|
description: "Hide an overlay created from a file",
|
||||||
example: r#"echo 'export alias f = "foo"' | save spam.nu
|
example: r#"echo 'export alias f = "foo"' | save spam.nu
|
||||||
overlay add spam.nu
|
overlay use spam.nu
|
||||||
overlay remove spam"#,
|
overlay hide spam"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Remove the last activated overlay",
|
description: "Hide the last activated overlay",
|
||||||
example: r#"module spam { export env FOO { "foo" } }
|
example: r#"module spam { export env FOO { "foo" } }
|
||||||
overlay add spam
|
overlay use spam
|
||||||
overlay remove"#,
|
overlay hide"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Keep the current working directory when removing an overlay",
|
description: "Keep the current working directory when removing an overlay",
|
||||||
example: r#"overlay new spam
|
example: r#"overlay new spam
|
||||||
cd some-dir
|
cd some-dir
|
||||||
overlay remove --keep-env [ PWD ] spam"#,
|
overlay hide --keep-env [ PWD ] spam"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
]
|
]
|
@ -74,7 +74,7 @@ impl Command for OverlayList {
|
|||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Get the last activated overlay",
|
description: "Get the last activated overlay",
|
||||||
example: r#"module spam { export def foo [] { "foo" } }
|
example: r#"module spam { export def foo [] { "foo" } }
|
||||||
overlay add spam
|
overlay use spam
|
||||||
overlay list | last"#,
|
overlay list | last"#,
|
||||||
result: Some(Value::String {
|
result: Some(Value::String {
|
||||||
val: "spam".to_string(),
|
val: "spam".to_string(),
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
mod add;
|
|
||||||
mod command;
|
mod command;
|
||||||
|
mod hide;
|
||||||
mod list;
|
mod list;
|
||||||
mod new;
|
mod new;
|
||||||
mod remove;
|
mod use_;
|
||||||
|
|
||||||
pub use add::OverlayAdd;
|
|
||||||
pub use command::Overlay;
|
pub use command::Overlay;
|
||||||
|
pub use hide::OverlayHide;
|
||||||
pub use list::OverlayList;
|
pub use list::OverlayList;
|
||||||
pub use new::OverlayNew;
|
pub use new::OverlayNew;
|
||||||
pub use remove::OverlayRemove;
|
pub use use_::OverlayUse;
|
||||||
|
@ -6,23 +6,23 @@ use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Spanne
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct OverlayAdd;
|
pub struct OverlayUse;
|
||||||
|
|
||||||
impl Command for OverlayAdd {
|
impl Command for OverlayUse {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"overlay add"
|
"overlay use"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
"Add definitions from a module as an overlay"
|
"Use definitions from a module as an overlay"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("overlay add")
|
Signature::build("overlay use")
|
||||||
.required(
|
.required(
|
||||||
"name",
|
"name",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"Module name to create overlay for",
|
"Module name to use overlay for",
|
||||||
)
|
)
|
||||||
.optional(
|
.optional(
|
||||||
"as",
|
"as",
|
||||||
@ -145,21 +145,21 @@ impl Command for OverlayAdd {
|
|||||||
Example {
|
Example {
|
||||||
description: "Create an overlay from a module",
|
description: "Create an overlay from a module",
|
||||||
example: r#"module spam { export def foo [] { "foo" } }
|
example: r#"module spam { export def foo [] { "foo" } }
|
||||||
overlay add spam
|
overlay use spam
|
||||||
foo"#,
|
foo"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Create an overlay with a prefix",
|
description: "Create an overlay with a prefix",
|
||||||
example: r#"echo 'export def foo { "foo" }'
|
example: r#"echo 'export def foo { "foo" }'
|
||||||
overlay add --prefix spam
|
overlay use --prefix spam
|
||||||
spam foo"#,
|
spam foo"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Create an overlay from a file",
|
description: "Create an overlay from a file",
|
||||||
example: r#"echo 'export env FOO { "foo" }' | save spam.nu
|
example: r#"echo 'export env FOO { "foo" }' | save spam.nu
|
||||||
overlay add spam.nu
|
overlay use spam.nu
|
||||||
$env.FOO"#,
|
$env.FOO"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
@ -175,6 +175,6 @@ mod test {
|
|||||||
fn test_examples() {
|
fn test_examples() {
|
||||||
use crate::test_examples;
|
use crate::test_examples;
|
||||||
|
|
||||||
test_examples(OverlayAdd {})
|
test_examples(OverlayUse {})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,10 +51,10 @@ pub fn create_default_context() -> EngineState {
|
|||||||
If,
|
If,
|
||||||
Ignore,
|
Ignore,
|
||||||
Overlay,
|
Overlay,
|
||||||
OverlayAdd,
|
OverlayUse,
|
||||||
OverlayList,
|
OverlayList,
|
||||||
OverlayNew,
|
OverlayNew,
|
||||||
OverlayRemove,
|
OverlayHide,
|
||||||
Let,
|
Let,
|
||||||
Metadata,
|
Metadata,
|
||||||
Module,
|
Module,
|
||||||
|
@ -735,7 +735,7 @@ fn parse_script_with_nested_scripts_success() {
|
|||||||
r#"
|
r#"
|
||||||
source ../foo.nu
|
source ../foo.nu
|
||||||
use lol_shell.nu
|
use lol_shell.nu
|
||||||
overlay add ../lol/lol_shell.nu
|
overlay use ../lol/lol_shell.nu
|
||||||
"#,
|
"#,
|
||||||
)])
|
)])
|
||||||
.with_files(vec![FileWithContentToBeTrimmed(
|
.with_files(vec![FileWithContentToBeTrimmed(
|
||||||
|
@ -152,13 +152,13 @@ pub enum ParseError {
|
|||||||
)]
|
)]
|
||||||
CantRemoveLastOverlay(#[label = "this is the last overlay, can't remove it"] Span),
|
CantRemoveLastOverlay(#[label = "this is the last overlay, can't remove it"] Span),
|
||||||
|
|
||||||
#[error("Cannot remove default overlay.")]
|
#[error("Cannot hide default overlay.")]
|
||||||
#[diagnostic(
|
#[diagnostic(
|
||||||
code(nu::parser::cant_remove_default_overlay),
|
code(nu::parser::cant_hide_default_overlay),
|
||||||
url(docsrs),
|
url(docsrs),
|
||||||
help("'{0}' is a default overlay. Default overlays cannot be removed.")
|
help("'{0}' is a default overlay. Default overlays cannot be hidden.")
|
||||||
)]
|
)]
|
||||||
CantRemoveDefaultOverlay(String, #[label = "can't remove overlay"] Span),
|
CantHideDefaultOverlay(String, #[label = "can't hide overlay"] Span),
|
||||||
|
|
||||||
#[error("Cannot add overlay.")]
|
#[error("Cannot add overlay.")]
|
||||||
#[diagnostic(code(nu::parser::cant_add_overlay_help), url(docsrs), help("{0}"))]
|
#[diagnostic(code(nu::parser::cant_add_overlay_help), url(docsrs), help("{0}"))]
|
||||||
@ -345,7 +345,7 @@ impl ParseError {
|
|||||||
ParseError::ActiveOverlayNotFound(s) => *s,
|
ParseError::ActiveOverlayNotFound(s) => *s,
|
||||||
ParseError::OverlayPrefixMismatch(_, _, s) => *s,
|
ParseError::OverlayPrefixMismatch(_, _, s) => *s,
|
||||||
ParseError::CantRemoveLastOverlay(s) => *s,
|
ParseError::CantRemoveLastOverlay(s) => *s,
|
||||||
ParseError::CantRemoveDefaultOverlay(_, s) => *s,
|
ParseError::CantHideDefaultOverlay(_, s) => *s,
|
||||||
ParseError::CantAddOverlayHelp(_, s) => *s,
|
ParseError::CantAddOverlayHelp(_, s) => *s,
|
||||||
ParseError::NotFound(s) => *s,
|
ParseError::NotFound(s) => *s,
|
||||||
ParseError::DuplicateCommandDef(s) => *s,
|
ParseError::DuplicateCommandDef(s) => *s,
|
||||||
|
@ -1823,8 +1823,8 @@ pub fn parse_overlay(
|
|||||||
let subcommand = working_set.get_span_contents(spans[1]);
|
let subcommand = working_set.get_span_contents(spans[1]);
|
||||||
|
|
||||||
match subcommand {
|
match subcommand {
|
||||||
b"add" => {
|
b"use" => {
|
||||||
return parse_overlay_add(working_set, spans, expand_aliases_denylist);
|
return parse_overlay_use(working_set, spans, expand_aliases_denylist);
|
||||||
}
|
}
|
||||||
b"list" => {
|
b"list" => {
|
||||||
// TODO: Abstract this code blob, it's repeated all over the place:
|
// TODO: Abstract this code blob, it's repeated all over the place:
|
||||||
@ -1884,8 +1884,8 @@ pub fn parse_overlay(
|
|||||||
b"new" => {
|
b"new" => {
|
||||||
return parse_overlay_new(working_set, spans, expand_aliases_denylist);
|
return parse_overlay_new(working_set, spans, expand_aliases_denylist);
|
||||||
}
|
}
|
||||||
b"remove" => {
|
b"hide" => {
|
||||||
return parse_overlay_remove(working_set, spans, expand_aliases_denylist);
|
return parse_overlay_hide(working_set, spans, expand_aliases_denylist);
|
||||||
}
|
}
|
||||||
_ => { /* continue parsing overlay */ }
|
_ => { /* continue parsing overlay */ }
|
||||||
}
|
}
|
||||||
@ -2045,23 +2045,23 @@ pub fn parse_overlay_new(
|
|||||||
(pipeline, None)
|
(pipeline, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_overlay_add(
|
pub fn parse_overlay_use(
|
||||||
working_set: &mut StateWorkingSet,
|
working_set: &mut StateWorkingSet,
|
||||||
spans: &[Span],
|
spans: &[Span],
|
||||||
expand_aliases_denylist: &[usize],
|
expand_aliases_denylist: &[usize],
|
||||||
) -> (Pipeline, Option<ParseError>) {
|
) -> (Pipeline, Option<ParseError>) {
|
||||||
if spans.len() > 1 && working_set.get_span_contents(span(&spans[0..2])) != b"overlay add" {
|
if spans.len() > 1 && working_set.get_span_contents(span(&spans[0..2])) != b"overlay use" {
|
||||||
return (
|
return (
|
||||||
garbage_pipeline(spans),
|
garbage_pipeline(spans),
|
||||||
Some(ParseError::UnknownState(
|
Some(ParseError::UnknownState(
|
||||||
"internal error: Wrong call name for 'overlay add' command".into(),
|
"internal error: Wrong call name for 'overlay use' command".into(),
|
||||||
span(spans),
|
span(spans),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Allow full import pattern as argument (requires custom naming of module/overlay)
|
// TODO: Allow full import pattern as argument (requires custom naming of module/overlay)
|
||||||
let (call, call_span) = match working_set.find_decl(b"overlay add", &Type::Any) {
|
let (call, call_span) = match working_set.find_decl(b"overlay use", &Type::Any) {
|
||||||
Some(decl_id) => {
|
Some(decl_id) => {
|
||||||
let ParsedInternalCall {
|
let ParsedInternalCall {
|
||||||
call,
|
call,
|
||||||
@ -2097,7 +2097,7 @@ pub fn parse_overlay_add(
|
|||||||
return (
|
return (
|
||||||
garbage_pipeline(spans),
|
garbage_pipeline(spans),
|
||||||
Some(ParseError::UnknownState(
|
Some(ParseError::UnknownState(
|
||||||
"internal error: 'overlay add' declaration not found".into(),
|
"internal error: 'overlay use' declaration not found".into(),
|
||||||
span(spans),
|
span(spans),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -2321,22 +2321,22 @@ pub fn parse_overlay_add(
|
|||||||
(pipeline, error)
|
(pipeline, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_overlay_remove(
|
pub fn parse_overlay_hide(
|
||||||
working_set: &mut StateWorkingSet,
|
working_set: &mut StateWorkingSet,
|
||||||
spans: &[Span],
|
spans: &[Span],
|
||||||
expand_aliases_denylist: &[usize],
|
expand_aliases_denylist: &[usize],
|
||||||
) -> (Pipeline, Option<ParseError>) {
|
) -> (Pipeline, Option<ParseError>) {
|
||||||
if spans.len() > 1 && working_set.get_span_contents(span(&spans[0..2])) != b"overlay remove" {
|
if spans.len() > 1 && working_set.get_span_contents(span(&spans[0..2])) != b"overlay hide" {
|
||||||
return (
|
return (
|
||||||
garbage_pipeline(spans),
|
garbage_pipeline(spans),
|
||||||
Some(ParseError::UnknownState(
|
Some(ParseError::UnknownState(
|
||||||
"internal error: Wrong call name for 'overlay remove' command".into(),
|
"internal error: Wrong call name for 'overlay hide' command".into(),
|
||||||
span(spans),
|
span(spans),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let call = match working_set.find_decl(b"overlay remove", &Type::Any) {
|
let call = match working_set.find_decl(b"overlay hide", &Type::Any) {
|
||||||
Some(decl_id) => {
|
Some(decl_id) => {
|
||||||
let ParsedInternalCall {
|
let ParsedInternalCall {
|
||||||
call,
|
call,
|
||||||
@ -2372,7 +2372,7 @@ pub fn parse_overlay_remove(
|
|||||||
return (
|
return (
|
||||||
garbage_pipeline(spans),
|
garbage_pipeline(spans),
|
||||||
Some(ParseError::UnknownState(
|
Some(ParseError::UnknownState(
|
||||||
"internal error: 'overlay remove' declaration not found".into(),
|
"internal error: 'overlay hide' declaration not found".into(),
|
||||||
span(spans),
|
span(spans),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -2410,7 +2410,7 @@ pub fn parse_overlay_remove(
|
|||||||
if overlay_name == DEFAULT_OVERLAY_NAME {
|
if overlay_name == DEFAULT_OVERLAY_NAME {
|
||||||
return (
|
return (
|
||||||
pipeline,
|
pipeline,
|
||||||
Some(ParseError::CantRemoveDefaultOverlay(
|
Some(ParseError::CantHideDefaultOverlay(
|
||||||
overlay_name,
|
overlay_name,
|
||||||
overlay_name_span,
|
overlay_name_span,
|
||||||
)),
|
)),
|
||||||
|
@ -4,7 +4,7 @@ use nu_test_support::{nu, nu_repl_code, pipeline};
|
|||||||
fn add_overlay() {
|
fn add_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -19,8 +19,8 @@ fn add_overlay() {
|
|||||||
fn add_overlay_twice() {
|
fn add_overlay_twice() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ fn add_overlay_twice() {
|
|||||||
fn add_prefixed_overlay() {
|
fn add_prefixed_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"spam foo"#,
|
r#"spam foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ fn add_prefixed_overlay() {
|
|||||||
fn add_prefixed_overlay_twice() {
|
fn add_prefixed_overlay_twice() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"spam foo"#,
|
r#"spam foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ fn add_prefixed_overlay_twice() {
|
|||||||
fn add_prefixed_overlay_mismatch_1() {
|
fn add_prefixed_overlay_mismatch_1() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
@ -82,8 +82,8 @@ fn add_prefixed_overlay_mismatch_1() {
|
|||||||
fn add_prefixed_overlay_mismatch_2() {
|
fn add_prefixed_overlay_mismatch_2() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
@ -98,9 +98,9 @@ fn add_prefixed_overlay_mismatch_2() {
|
|||||||
fn prefixed_overlay_keeps_custom_decl() {
|
fn prefixed_overlay_keeps_custom_decl() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"def bar [] { "bar" }"#,
|
r#"def bar [] { "bar" }"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bar"#,
|
r#"bar"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ fn prefixed_overlay_keeps_custom_decl() {
|
|||||||
fn add_overlay_env() {
|
fn add_overlay_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export env FOO { "foo" } }"#,
|
r#"module spam { export env FOO { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"$env.FOO"#,
|
r#"$env.FOO"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ fn add_overlay_env() {
|
|||||||
fn add_prefixed_overlay_env_no_prefix() {
|
fn add_prefixed_overlay_env_no_prefix() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export env FOO { "foo" } }"#,
|
r#"module spam { export env FOO { "foo" } }"#,
|
||||||
r#"overlay add --prefix spam"#,
|
r#"overlay use --prefix spam"#,
|
||||||
r#"$env.FOO"#,
|
r#"$env.FOO"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ fn add_prefixed_overlay_env_no_prefix() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay_from_file_decl() {
|
fn add_overlay_from_file_decl() {
|
||||||
let inp = &[r#"overlay add samples/spam.nu"#, r#"foo"#];
|
let inp = &[r#"overlay use samples/spam.nu"#, r#"foo"#];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||||
@ -155,7 +155,7 @@ fn add_overlay_from_file_decl() {
|
|||||||
// This one tests that the `nu_repl()` loop works correctly
|
// This one tests that the `nu_repl()` loop works correctly
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay_from_file_decl_cd() {
|
fn add_overlay_from_file_decl_cd() {
|
||||||
let inp = &[r#"cd samples"#, r#"overlay add spam.nu"#, r#"foo"#];
|
let inp = &[r#"cd samples"#, r#"overlay use spam.nu"#, r#"foo"#];
|
||||||
|
|
||||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ fn add_overlay_from_file_decl_cd() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay_from_file_alias() {
|
fn add_overlay_from_file_alias() {
|
||||||
let inp = &[r#"overlay add samples/spam.nu"#, r#"bar"#];
|
let inp = &[r#"overlay use samples/spam.nu"#, r#"bar"#];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||||
@ -175,7 +175,7 @@ fn add_overlay_from_file_alias() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay_from_file_env() {
|
fn add_overlay_from_file_env() {
|
||||||
let inp = &[r#"overlay add samples/spam.nu"#, r#"$env.BAZ"#];
|
let inp = &[r#"overlay use samples/spam.nu"#, r#"$env.BAZ"#];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||||
@ -188,7 +188,7 @@ fn add_overlay_from_file_env() {
|
|||||||
fn add_overlay_scoped() {
|
fn add_overlay_scoped() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"do { overlay add spam }"#,
|
r#"do { overlay use spam }"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -206,9 +206,9 @@ fn add_overlay_scoped() {
|
|||||||
fn update_overlay_from_module() {
|
fn update_overlay_from_module() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"module spam { export def foo [] { "bar" } }"#,
|
r#"module spam { export def foo [] { "bar" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -223,9 +223,9 @@ fn update_overlay_from_module() {
|
|||||||
fn update_overlay_from_module_env() {
|
fn update_overlay_from_module_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export env FOO { "foo" } }"#,
|
r#"module spam { export env FOO { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"module spam { export env FOO { "bar" } }"#,
|
r#"module spam { export env FOO { "bar" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"$env.FOO"#,
|
r#"$env.FOO"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -240,8 +240,8 @@ fn update_overlay_from_module_env() {
|
|||||||
fn remove_overlay() {
|
fn remove_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -259,8 +259,8 @@ fn remove_overlay() {
|
|||||||
fn remove_last_overlay() {
|
fn remove_last_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay remove"#,
|
r#"overlay hide"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -278,8 +278,8 @@ fn remove_last_overlay() {
|
|||||||
fn remove_overlay_scoped() {
|
fn remove_overlay_scoped() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"do { overlay remove spam }"#,
|
r#"do { overlay hide spam }"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -294,8 +294,8 @@ fn remove_overlay_scoped() {
|
|||||||
fn remove_overlay_env() {
|
fn remove_overlay_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export env FOO { "foo" } }"#,
|
r#"module spam { export env FOO { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"$env.FOO"#,
|
r#"$env.FOO"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ fn remove_overlay_env() {
|
|||||||
fn remove_overlay_scoped_env() {
|
fn remove_overlay_scoped_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export env FOO { "foo" } }"#,
|
r#"module spam { export env FOO { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"do { overlay remove spam }"#,
|
r#"do { overlay hide spam }"#,
|
||||||
r#"$env.FOO"#,
|
r#"$env.FOO"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ fn list_default_overlay() {
|
|||||||
fn list_last_overlay() {
|
fn list_last_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay list | last"#,
|
r#"overlay list | last"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ fn list_last_overlay() {
|
|||||||
fn list_overlay_scoped() {
|
fn list_overlay_scoped() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"do { overlay list | last }"#,
|
r#"do { overlay list | last }"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -366,9 +366,9 @@ fn list_overlay_scoped() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_discard_decl() {
|
fn remove_overlay_discard_decl() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def bagr [] { "bagr" }"#,
|
r#"def bagr [] { "bagr" }"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -385,9 +385,9 @@ fn remove_overlay_discard_decl() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_discard_alias() {
|
fn remove_overlay_discard_alias() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"alias bagr = "bagr""#,
|
r#"alias bagr = "bagr""#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -404,9 +404,9 @@ fn remove_overlay_discard_alias() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_discard_env() {
|
fn remove_overlay_discard_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"let-env BAGR = `bagr`"#,
|
r#"let-env BAGR = `bagr`"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"$env.BAGR"#,
|
r#"$env.BAGR"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -420,9 +420,9 @@ fn remove_overlay_discard_env() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_decl() {
|
fn remove_overlay_keep_decl() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def bagr [] { "bagr" }"#,
|
r#"def bagr [] { "bagr" }"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -436,9 +436,9 @@ fn remove_overlay_keep_decl() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_alias() {
|
fn remove_overlay_keep_alias() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"alias bagr = `bagr`"#,
|
r#"alias bagr = `bagr`"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -452,9 +452,9 @@ fn remove_overlay_keep_alias() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_env() {
|
fn remove_overlay_keep_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"let-env BAGR = `bagr`"#,
|
r#"let-env BAGR = `bagr`"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"$env.BAGR"#,
|
r#"$env.BAGR"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -468,9 +468,9 @@ fn remove_overlay_keep_env() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_discard_overwritten_decl() {
|
fn remove_overlay_keep_discard_overwritten_decl() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def foo [] { 'bar' }"#,
|
r#"def foo [] { 'bar' }"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -487,9 +487,9 @@ fn remove_overlay_keep_discard_overwritten_decl() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_discard_overwritten_alias() {
|
fn remove_overlay_keep_discard_overwritten_alias() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"alias bar = `baz`"#,
|
r#"alias bar = `baz`"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bar"#,
|
r#"bar"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -506,9 +506,9 @@ fn remove_overlay_keep_discard_overwritten_alias() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_discard_overwritten_env() {
|
fn remove_overlay_keep_discard_overwritten_env() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"let-env BAZ = `bagr`"#,
|
r#"let-env BAZ = `bagr`"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"$env.BAZ"#,
|
r#"$env.BAZ"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -522,11 +522,11 @@ fn remove_overlay_keep_discard_overwritten_env() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_decl_in_latest_overlay() {
|
fn remove_overlay_keep_decl_in_latest_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def bagr [] { 'bagr' }"#,
|
r#"def bagr [] { 'bagr' }"#,
|
||||||
r#"module eggs { }"#,
|
r#"module eggs { }"#,
|
||||||
r#"overlay add eggs"#,
|
r#"overlay use eggs"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -540,11 +540,11 @@ fn remove_overlay_keep_decl_in_latest_overlay() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_alias_in_latest_overlay() {
|
fn remove_overlay_keep_alias_in_latest_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"alias bagr = `bagr`"#,
|
r#"alias bagr = `bagr`"#,
|
||||||
r#"module eggs { }"#,
|
r#"module eggs { }"#,
|
||||||
r#"overlay add eggs"#,
|
r#"overlay use eggs"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"bagr"#,
|
r#"bagr"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -558,11 +558,11 @@ fn remove_overlay_keep_alias_in_latest_overlay() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn remove_overlay_keep_env_in_latest_overlay() {
|
fn remove_overlay_keep_env_in_latest_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"let-env BAGR = `bagr`"#,
|
r#"let-env BAGR = `bagr`"#,
|
||||||
r#"module eggs { }"#,
|
r#"module eggs { }"#,
|
||||||
r#"overlay add eggs"#,
|
r#"overlay use eggs"#,
|
||||||
r#"overlay remove --keep-custom spam"#,
|
r#"overlay hide --keep-custom spam"#,
|
||||||
r#"$env.BAGR"#,
|
r#"$env.BAGR"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -576,10 +576,10 @@ fn remove_overlay_keep_env_in_latest_overlay() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn preserve_overrides() {
|
fn preserve_overrides() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def foo [] { "new-foo" }"#,
|
r#"def foo [] { "new-foo" }"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -593,10 +593,10 @@ fn preserve_overrides() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn reset_overrides() {
|
fn reset_overrides() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"def foo [] { "new-foo" }"#,
|
r#"def foo [] { "new-foo" }"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"overlay add samples/spam.nu"#,
|
r#"overlay use samples/spam.nu"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ fn overlay_keep_pwd() {
|
|||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay new spam"#,
|
r#"overlay new spam"#,
|
||||||
r#"cd samples"#,
|
r#"cd samples"#,
|
||||||
r#"overlay remove --keep-env [ PWD ] spam"#,
|
r#"overlay hide --keep-env [ PWD ] spam"#,
|
||||||
r#"$env.PWD | path basename"#,
|
r#"$env.PWD | path basename"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ fn overlay_keep_pwd() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn overlay_wrong_rename_type() {
|
fn overlay_wrong_rename_type() {
|
||||||
let inp = &[r#"module spam {}"#, r#"overlay add spam as { echo foo }"#];
|
let inp = &[r#"module spam {}"#, r#"overlay use spam as { echo foo }"#];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ fn overlay_wrong_rename_type() {
|
|||||||
fn overlay_add_renamed() {
|
fn overlay_add_renamed() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam as eggs --prefix"#,
|
r#"overlay use spam as eggs --prefix"#,
|
||||||
r#"eggs foo"#,
|
r#"eggs foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ fn overlay_add_renamed() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn overlay_add_renamed_from_file() {
|
fn overlay_add_renamed_from_file() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"overlay add samples/spam.nu as eggs --prefix"#,
|
r#"overlay use samples/spam.nu as eggs --prefix"#,
|
||||||
r#"eggs foo"#,
|
r#"eggs foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -676,9 +676,9 @@ fn overlay_add_renamed_from_file() {
|
|||||||
fn overlay_cant_rename_existing_overlay() {
|
fn overlay_cant_rename_existing_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam"#,
|
r#"overlay use spam"#,
|
||||||
r#"overlay remove spam"#,
|
r#"overlay hide spam"#,
|
||||||
r#"overlay add spam as eggs"#,
|
r#"overlay use spam as eggs"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
@ -692,8 +692,8 @@ fn overlay_cant_rename_existing_overlay() {
|
|||||||
fn overlay_can_add_renamed_overlay() {
|
fn overlay_can_add_renamed_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam as eggs --prefix"#,
|
r#"overlay use spam as eggs --prefix"#,
|
||||||
r#"overlay add spam --prefix"#,
|
r#"overlay use spam --prefix"#,
|
||||||
r#"(spam foo) + (eggs foo)"#,
|
r#"(spam foo) + (eggs foo)"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -708,8 +708,8 @@ fn overlay_can_add_renamed_overlay() {
|
|||||||
fn overlay_remove_renamed_overlay() {
|
fn overlay_remove_renamed_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam as eggs"#,
|
r#"overlay use spam as eggs"#,
|
||||||
r#"overlay remove eggs"#,
|
r#"overlay hide eggs"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -724,9 +724,9 @@ fn overlay_remove_renamed_overlay() {
|
|||||||
fn overlay_remove_and_add_renamed_overlay() {
|
fn overlay_remove_and_add_renamed_overlay() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
r#"module spam { export def foo [] { "foo" } }"#,
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
r#"overlay add spam as eggs"#,
|
r#"overlay use spam as eggs"#,
|
||||||
r#"overlay remove eggs"#,
|
r#"overlay hide eggs"#,
|
||||||
r#"overlay add eggs"#,
|
r#"overlay use eggs"#,
|
||||||
r#"foo"#,
|
r#"foo"#,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ fn parse_file_relative_to_parsed_file() {
|
|||||||
r#"
|
r#"
|
||||||
source ../../foo.nu
|
source ../../foo.nu
|
||||||
use ../lol_shell.nu
|
use ../lol_shell.nu
|
||||||
overlay add ../../lol/lol_shell.nu
|
overlay use ../../lol/lol_shell.nu
|
||||||
|
|
||||||
$'($env.FOO) (lol_shell ls) (ls)'
|
$'($env.FOO) (lol_shell ls) (ls)'
|
||||||
"#,
|
"#,
|
||||||
|
Loading…
Reference in New Issue
Block a user