From 6f6f09c54d5b7bdabec17b6c4847dbf14e1645f1 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Tue, 28 Jan 2025 14:50:29 +0000 Subject: [PATCH] Fixed prompt error on interrupt --- dot_config/nushell/prompt.nu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dot_config/nushell/prompt.nu b/dot_config/nushell/prompt.nu index 0917ba4..5cfd53d 100644 --- a/dot_config/nushell/prompt.nu +++ b/dot_config/nushell/prompt.nu @@ -2,6 +2,13 @@ def get_env [s: string]: string -> string { try { $env | get --ignore-errors $s } catch { "" } } +def get_status []: nothing -> string { + match (get_env "LAST_EXIT_CODE") { + "0" => "0", + _ => "1", + } +} + export def create_left_prompt []: nothing -> string { ^starship prompt --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns }