From 5a196913d20b6fbe00f9d906eadd6169eb17e19b Mon Sep 17 00:00:00 2001 From: qodelicious <162776175+qodelicious@users.noreply.github.com> Date: Thu, 22 Oct 2026 04:25:50 +0000 Subject: [PATCH] jalon-git: fix the prompt on current nushell --- modules/prompt/jalon-git.nu | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/prompt/jalon-git.nu b/modules/prompt/jalon-git.nu index 0dffde4c3..93d43affc 100644 --- a/modules/prompt/jalon-git.nu +++ b/modules/prompt/jalon-git.nu @@ -114,9 +114,11 @@ def current-dir-style [] { let current_dir_abbreviated = if $current_dir == $nu.home-dir { '~' } else { - let current_dir_relative_to_home = ( - do --ignore-errors { $current_dir | path relative-to $nu.home-dir } | str join - ) + let current_dir_relative_to_home = try { + $current_dir | path relative-to $nu.home-dir + } catch { + '' + } if ($current_dir_relative_to_home | is-empty) == false { $'~(char separator)($current_dir_relative_to_home)' @@ -162,12 +164,12 @@ def duration-style [] { def fast-git-style [] { let s = get-styles - let b_info = (do -p { git --no-optional-locks branch -v } | str trim) + let b_info = (git --no-optional-locks branch -v | complete | get stdout | str trim) if ($b_info | is-empty) { '' } else { let info = ($b_info | parse -r '\* (?(\([\S ]+\))|([\w\/\-\.]+)) +\w+ (\[((?[^\]]+))+\])?') - let state_list = ($info.state.0 | split row ', ' | each { |it| + let state_list = ($info.state.0 | default '' | split row ', ' | each { |it| let p = ($it | parse "{s} {n}") if ($p | is-empty) { if ($it | str starts-with "gone") { @@ -190,7 +192,7 @@ def fast-git-style [] { def full-git-style [] { let s = get-styles - let info_lines = (do -p { git --no-optional-locks status --porcelain=2 --branch } | str trim | lines) + let info_lines = (git --no-optional-locks status --porcelain=2 --branch | complete | get stdout | str trim | lines) if ($info_lines | is-empty) { '' } else {