From 8e086d8771774c47fc514731ad5d1d35ca70272c Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:10:20 -0500 Subject: [PATCH] update prompts scripts with new `str replace` syntax (#579) --- modules/prompt/full-line.nu | 4 ++-- modules/prompt/oh-my-minimal.nu | 6 +++--- modules/prompt/oh-my-v2.nu | 6 +++--- modules/prompt/oh-my.nu | 6 +++--- modules/prompt/panache-git.nu | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/prompt/full-line.nu b/modules/prompt/full-line.nu index 08ef111..d4579b1 100644 --- a/modules/prompt/full-line.nu +++ b/modules/prompt/full-line.nu @@ -64,13 +64,13 @@ def dir_string [] { } 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) let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) - $"($path_color)($dir)(ansi reset)" | str replace --all --string (char path_sep) $"($separator_color)/($path_color)" + $"($path_color)($dir)(ansi reset)" | str replace --all (char path_sep) $"($separator_color)/($path_color)" } # Following code cheerfully ~~stolen~~ adapted from: diff --git a/modules/prompt/oh-my-minimal.nu b/modules/prompt/oh-my-minimal.nu index a477ba1..3065b5d 100644 --- a/modules/prompt/oh-my-minimal.nu +++ b/modules/prompt/oh-my-minimal.nu @@ -20,14 +20,14 @@ def home_abbrev [os] { let is_home_in_path = ($env.PWD | str starts-with $nu.home-path) if ($is_home_in_path == true) { if ($os == "Windows") { - let home = ($nu.home-path | str replace -a '\\' '/') - let pwd = ($env.PWD | str replace -a '\\' '/') + let home = ($nu.home-path | str replace -ar '\\' '/') + let pwd = ($env.PWD | str replace -ar '\\' '/') $pwd | str replace $home '~' } else { $env.PWD | str replace $nu.home-path '~' } } else { - $env.PWD | str replace -a '\\' '/' + $env.PWD | str replace -ar '\\' '/' } } diff --git a/modules/prompt/oh-my-v2.nu b/modules/prompt/oh-my-v2.nu index a918041..2f2e887 100644 --- a/modules/prompt/oh-my-v2.nu +++ b/modules/prompt/oh-my-v2.nu @@ -240,14 +240,14 @@ def home_abbrev [os_name] { let is_home_in_path = ($env.PWD | str starts-with $nu.home-path) if $is_home_in_path { if ($os_name == "windows") { - let home = ($nu.home-path | str replace -a '\\' '/') - let pwd = ($env.PWD | str replace -a '\\' '/') + let home = ($nu.home-path | str replace -ar '\\' '/') + let pwd = ($env.PWD | str replace -ar '\\' '/') $pwd | str replace $home '~' } else { $env.PWD | str replace $nu.home-path '~' } } else { - $env.PWD | str replace -a '\\' '/' + $env.PWD | str replace -ar '\\' '/' } } diff --git a/modules/prompt/oh-my.nu b/modules/prompt/oh-my.nu index 41a460d..103cd9c 100644 --- a/modules/prompt/oh-my.nu +++ b/modules/prompt/oh-my.nu @@ -17,8 +17,8 @@ def home_abbrev [os_name] { let is_home_in_path = ($env.PWD | str starts-with $nu.home-path) if $is_home_in_path { if ($os_name =~ "windows") { - let home = ($nu.home-path | str replace -a '\\' '/') - let pwd = ($env.PWD | str replace -a '\\' '/') + let home = ($nu.home-path | str replace -ar '\\' '/') + let pwd = ($env.PWD | str replace -ar '\\' '/') $pwd | str replace $home '~' } else { $env.PWD | str replace $nu.home-path '~' @@ -26,7 +26,7 @@ def home_abbrev [os_name] { } else { if ($os_name =~ "windows") { # remove the C: from the path - $env.PWD | str replace -a '\\' '/' | str substring 2.. + $env.PWD | str replace -ar '\\' '/' | str substring 2.. } else { $env.PWD } diff --git a/modules/prompt/panache-git.nu b/modules/prompt/panache-git.nu index 58decbc..0ae9068 100644 --- a/modules/prompt/panache-git.nu +++ b/modules/prompt/panache-git.nu @@ -33,9 +33,9 @@ export def current-dir [] { let in_sub_dir_of_home = ($current_dir_relative_to_home | is-empty | nope) let current_dir_abbreviated = (if $in_sub_dir_of_home { - $'~(char separator)($current_dir_relative_to_home)' | str replace -a '\\' '/' + $'~(char separator)($current_dir_relative_to_home)' | str replace -ar '\\' '/' } else { - $current_dir | str replace -a '\\' '/' + $current_dir | str replace -ar '\\' '/' }) $'(ansi reset)($current_dir_abbreviated)'