From 4a1b3e26eff5e1ce88641d63e9f4321b1d993af2 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Sat, 19 Aug 2023 07:39:36 +1200 Subject: [PATCH] fix default-env after latest changes (#10052) # Description default env.nu is currently broken after the changes to `str replace`. This PR should help fix it. # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-utils/src/sample_config/default_env.nu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/nu-utils/src/sample_config/default_env.nu b/crates/nu-utils/src/sample_config/default_env.nu index 6e35eacf71..fc827a5428 100644 --- a/crates/nu-utils/src/sample_config/default_env.nu +++ b/crates/nu-utils/src/sample_config/default_env.nu @@ -13,7 +13,7 @@ def create_left_prompt [] { } let dir = ([ - ($env.PWD | str substring 0..($home | str length) | str replace --string $home "~"), + ($env.PWD | str substring 0..($home | str length) | str replace $home "~"), ($env.PWD | str substring ($home | str length)..) ] | str join) @@ -21,7 +21,7 @@ def create_left_prompt [] { let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) let path_segment = $"($path_color)($dir)" - $path_segment | str replace --all --string (char path_sep) $"($separator_color)/($path_color)" + $path_segment | str replace --all (char path_sep) $"($separator_color)/($path_color)" } def create_right_prompt [] { @@ -30,8 +30,8 @@ def create_right_prompt [] { (ansi reset) (ansi magenta) (date now | format date '%Y/%m/%d %r') - ] | str join | str replace --all "([/:])" $"(ansi green)${1}(ansi magenta)" | - str replace --all "([AP]M)" $"(ansi magenta_underline)${1}") + ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | + str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ (ansi rb)