fix: overhaul fish_right_prompt — exit code, dim time, remove docker dep

This commit is contained in:
2026-06-12 00:41:53 -04:00
parent 4c77f3b0af
commit b5513ccbde
+17 -19
View File
@@ -1,34 +1,32 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# SYNOPSIS
# fish_right_prompt
#
# DESCRIPTION
# Renders the right-side prompt showing the active Docker context (in blue,
# when non-default) and the current timestamp.
# Renders the right-side prompt. Shows a red ✘ with the exit code when the
# last command failed (hidden on success), followed by the current time in
# Catppuccin Overlay0 (dim). Rendered regardless of C3 state so it pairs
# correctly with both the starship and the Catppuccin fallback left prompt.
#
# RETURNS
# 0 Always
#
# EXAMPLE
# # Rendered automatically by Fish shell; not called directly.
# # Rendered automatically by fish; not called directly.
function fish_right_prompt --description 'Execute fish_right_prompt'
# Opinionated guard (C3): no right prompt when overrides are disabled.
__fish_config_op_enabled __fish_config_op_overrides; or return
set -l last_status $status
# 1. Docker Context in Blue
set -l docker_ctx (docker context show 2>/dev/null)
if test -n "$docker_ctx"; and test "$docker_ctx" != default
set_color blue
echo -n "󰡨 $docker_ctx "
# Failed command: red ✘ + exit code; hidden when 0
if test $last_status -ne 0
set_color '#f38ba8'
echo -n "$last_status "
set_color normal
end
# 2. Timestamp Logic with Fallback
set_color brblack
if type -q __bobthefish_timestamp
__bobthefish_timestamp
else
# Manual fallback format: Wed Feb 11 15:04:28 2026
date "+%a %b %d %H:%M:%S %Y"
end
# Timestamp — Catppuccin Overlay0 (dim)
set_color '#6c7086'
date +%X
set_color normal
end