mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 15:11:52 +02:00
Primitives now use color closures when printed on the command line (#7650)
# Description Closes #7554  # User-Facing Changes See above. # 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 -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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. Co-authored-by: Reilly Wood <26268125+rgwood@users.noreply.github.com>
This commit is contained in:
@ -158,6 +158,7 @@ macro_rules! nu {
|
||||
|
||||
let target_cwd = $opts.cwd.unwrap_or(".".to_string());
|
||||
let locale = $opts.locale.unwrap_or("en_US.UTF-8".to_string());
|
||||
let minimal_config = $opts.minimal_config.unwrap_or(true);
|
||||
|
||||
let mut command = Command::new($crate::fs::executable_path());
|
||||
command
|
||||
@ -167,12 +168,16 @@ macro_rules! nu {
|
||||
.env(NATIVE_PATH_ENV_VAR, paths_joined)
|
||||
// .arg("--skip-plugins")
|
||||
// .arg("--no-history")
|
||||
// .arg("--config-file")
|
||||
// .arg($crate::fs::DisplayPath::display_path(&$crate::fs::fixtures().join("playground/config/default.toml")))
|
||||
.arg(format!("-c {}", escape_quote_string(path)))
|
||||
.stdout(Stdio::piped())
|
||||
// .stdin(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
// Use this minimal config in most tests.
|
||||
// Notably, this disables color_config to allow string output to be more easily compared.
|
||||
if minimal_config {
|
||||
command.arg("--config")
|
||||
.arg($crate::fs::fixtures().join("playground/config/minimal.nu").display().to_string());
|
||||
}
|
||||
|
||||
let mut process = match command.spawn()
|
||||
{
|
||||
@ -203,6 +208,7 @@ macro_rules! nu {
|
||||
struct NuOpts {
|
||||
cwd: Option<String>,
|
||||
locale: Option<String>,
|
||||
minimal_config: Option<bool>,
|
||||
}
|
||||
|
||||
nu!(@options [ ] $($token)*)
|
||||
@ -276,6 +282,8 @@ macro_rules! nu_with_plugins {
|
||||
.arg(commands)
|
||||
.arg("--plugin-config")
|
||||
.arg(temp_plugin_file)
|
||||
.arg("--config")
|
||||
.arg($crate::fs::fixtures().join("playground/config/minimal.nu").display().to_string())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
Reference in New Issue
Block a user