e651566e14
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.
40 lines
1.3 KiB
Fish
40 lines
1.3 KiB
Fish
# Copyright (C) 2026 Rootiest
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# SYNOPSIS
|
|
# __fish_real_command <name>
|
|
#
|
|
# DESCRIPTION
|
|
# Resolves the real on-disk binary for <name>, skipping any of this
|
|
# config's own generated wrapper shims. The PTY-logging wrappers we drop
|
|
# in ~/.local/bin (paru, yay) shadow the real binary on PATH; this walks
|
|
# every PATH match in order and returns the first one that is NOT one of
|
|
# our wrappers, identified by the "# <name>-wrapper-version:" marker line.
|
|
#
|
|
# This intentionally never returns one of our own wrappers, so callers
|
|
# that embed the result in a generated wrapper cannot create a shim that
|
|
# recurses into itself.
|
|
#
|
|
# ARGUMENTS
|
|
# name Command name to resolve (e.g. paru, yay)
|
|
#
|
|
# EXIT STATUS
|
|
# 0 A non-wrapper binary was found
|
|
# 1 No non-wrapper binary found on PATH
|
|
#
|
|
# RETURNS
|
|
# The resolved binary's real path, printed to stdout (nothing on failure)
|
|
#
|
|
# EXAMPLE
|
|
# set -l real (__fish_real_command paru) # -> /usr/bin/paru, not the shim
|
|
function __fish_real_command --argument-names name
|
|
for p in (command -sa $name)
|
|
# -I: binary files (real ELF binaries) count as no-match and are
|
|
# returned; only our text wrapper scripts carry the marker and skip.
|
|
grep -qsIF -- "# $name-wrapper-version:" $p; and continue
|
|
echo $p
|
|
return 0
|
|
end
|
|
return 1
|
|
end
|