Files
fish-config/functions/fish_right_prompt.fish
T
rootiest e651566e14 docs(functions): split RETURNS into EXIT STATUS and stdout RETURNS
RETURNS previously conflated fish's $status exit code with genuine
stdout/printed output, e.g. rm listing "0/1" as if they were print
values rather than exit codes. Rename RETURNS to EXIT STATUS across
all 83 documented functions, and reintroduce RETURNS as a distinct
label reserved for the 15 functions that actually print to stdout.

Update build-manual.py's ENTRY_HEADS to render Exit Status before
Returns, manualtools.py's SECTIONS constant, and AGENTS.md's label
order and label-usage guidance to match. Add two verify-manual.py
regression tests: EXIT STATUS bodies must never contain stray
stdout/printed language, and Returns: must always render after
Exit Status: when both are present. Regenerate docs/fish-config.md.
2026-07-26 16:41:57 -04:00

44 lines
1.3 KiB
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# SYNOPSIS
# fish_right_prompt
#
# DESCRIPTION
# Renders the right-side prompt. Always shows a dim timestamp. When the last
# command failed, prefixes it with a red ✘ and the exit code. When starship
# is installed and C3 overrides are enabled, also shows the active Docker
# context (if non-default) — that block is paired with the starship prompt
# which already guards on both conditions.
#
# EXIT STATUS
# 0 Always
#
# EXAMPLE
# # Rendered automatically by fish; not called directly.
function fish_right_prompt
set -l last_status $status
# 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
# Docker context — only relevant alongside the starship prompt
if type -q starship; and __fish_config_op_enabled __fish_config_op_overrides
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 "
set_color normal
end
end
# Timestamp — Catppuccin Overlay0 (dim)
set_color '#6c7086'
date "+%a %b %d %H:%M:%S %Y"
set_color normal
end