Further prompt fixes

This commit is contained in:
2025-01-28 21:01:09 +00:00
parent 6f6f09c54d
commit c219ee08f8

View File

@@ -10,15 +10,15 @@ def get_status []: nothing -> string {
}
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
^starship prompt --cmd-duration (get_env "CMD_DURATION_MS") --status (get_status) --terminal-width (term size).columns
}
export def create_right_prompt []: nothing -> string {
^starship prompt --right --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
^starship prompt --right --cmd-duration (get_env "CMD_DURATION_MS") --status (get_status) --terminal-width (term size).columns
}
export def create_continuation_prompt []: nothing -> string {
^starship prompt --continuation --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
^starship prompt --continuation --cmd-duration (get_env "CMD_DURATION_MS") --status (get_status) --terminal-width (term size).columns
}
def parse_ms_to_human_readable [ms: string]: string -> string {
@@ -41,12 +41,12 @@ def parse_ms_to_human_readable [ms: string]: string -> string {
}
export def create_transient_prompt_left []: nothing -> string {
if (get_env "LAST_EXIT_CODE") == 0 {
if (get_env "LAST_EXIT_CODE") == "0" {
$"(ansi green_bold)󱔳(ansi reset)"
} else {
$"(ansi red_bold)󱔷(ansi reset)"
}
}
export def create_transient_prompt_indicator []: nothing -> string {
$"(ansi blue_bold) 󰔛 (parse_ms_to_human_readable (get_env "CMD_DURATION_MS")) (if (get_env "LAST_EXIT_CODE") == 0 { ansi green_bold } else { ansi red_bold })(ansi reset) "
$"(ansi blue_bold) 󰔛 (parse_ms_to_human_readable (get_env "CMD_DURATION_MS")) (if (get_env "LAST_EXIT_CODE") == "0" { ansi green_bold } else { ansi red_bold })(ansi reset) "
}