Fix file lookup in parser keywords; Refactor nu_repl (#6185)

* Fix file lookup in parser keywords

* Make nu_repl a testbin; Fix wrong cwd test error
This commit is contained in:
Jakub Žádník
2022-07-29 23:42:00 +03:00
committed by GitHub
parent 7a820b1304
commit d6f4189c7b
10 changed files with 353 additions and 219 deletions

View File

@ -35,6 +35,25 @@ pub fn pipeline(commands: &str) -> String {
.to_string()
}
pub fn nu_repl_code(source_lines: &[&str]) -> String {
let mut out = String::from("nu --testbin=nu_repl [ ");
for line in source_lines.iter() {
// convert each "line" to really be a single line to prevent nu! macro joining the newlines
// with ';'
let line = pipeline(line);
out.push('`');
out.push_str(&line);
out.push('`');
out.push(' ');
}
out.push(']');
out
}
pub fn shell_os_paths() -> Vec<std::path::PathBuf> {
let mut original_paths = vec![];