db33d9cff7
- logs.fish: add yay category, ov-powered viewing for paru/yay (section headers, color highlights, ==> AUR build markers) and scrollback logs (OSC 133;A sticky prompt headers); add fzf Ctrl-D delete with Y/n confirm and list refresh, ? toggleable help overlay; run _scrollback_prune_junk before building file list - _scrollback_prune_junk: new utility to remove empty, single-line, and Kitty tab-rename noise logs before display and before max-file pruning; called from both logs and smart_exit - smart_exit: call _scrollback_prune_junk before counting toward max files - conf.d/yay-wrapper.fish: auto-generate ~/.local/bin/yay logging wrapper mirroring paru-wrapper; tees output to timestamped logs, prunes old ones - conf.d/starship.fish: move fish_prompt from config.fish; emit OSC 133;A after the prompt's leading newline so the marker lands on the info-bar line rather than the blank line above it; guard with type -q starship so clean fish sessions use built-in markers unchanged - config.fish: remove inline fish_prompt block (now in conf.d/starship.fish); add return sentinel at EOF to prevent tool-injected init lines from running - completions/ov.fish: add ov tab completions - README.md: document all of the above
48 lines
1.6 KiB
Fish
48 lines
1.6 KiB
Fish
# Copyright (C) 2026 Rootiest
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
# Generates ~/.local/bin/yay on first run (and on version bump) when
|
|
# /usr/bin/yay is installed. The wrapper tees yay output to a
|
|
# timestamped log file and prunes old logs, mirroring smart_exit behavior.
|
|
|
|
set -l _yay_real /usr/bin/yay
|
|
set -l _yay_wrapper "$HOME/.local/bin/yay"
|
|
set -l _yay_wrapper_version 1
|
|
|
|
# Skip entirely if the real yay binary isn't present
|
|
test -x $_yay_real; or return
|
|
|
|
# Check if wrapper already exists at the expected version
|
|
if test -f $_yay_wrapper
|
|
and grep -q "# yay-wrapper-version: $_yay_wrapper_version" $_yay_wrapper 2>/dev/null
|
|
set --erase _yay_real _yay_wrapper _yay_wrapper_version
|
|
return
|
|
end
|
|
|
|
mkdir -p (dirname $_yay_wrapper)
|
|
|
|
printf '%s\n' \
|
|
'#!/usr/bin/env bash' \
|
|
"# yay-wrapper-version: $_yay_wrapper_version" \
|
|
'# Auto-generated by conf.d/yay-wrapper.fish — do not edit by hand.' \
|
|
'# Tees yay output to a timestamped log file and prunes old ones.' \
|
|
'set -o pipefail' \
|
|
'' \
|
|
'log_dir="${SCROLLBACK_HISTORY_DIR:-$HOME/.terminal_history}"' \
|
|
'mkdir -p "$log_dir"' \
|
|
'log_file="$log_dir/yay_$(date +%Y-%m-%d_%H-%M-%S).log"' \
|
|
'' \
|
|
'/usr/bin/yay "$@" 2>&1 | tee "$log_file"' \
|
|
'' \
|
|
'max_files="${SCROLLBACK_HISTORY_MAX_FILES:-100}"' \
|
|
'mapfile -t logs < <(ls -1t "$log_dir"/yay_*.log 2>/dev/null)' \
|
|
'excess=$(( ${#logs[@]} - max_files ))' \
|
|
'for (( i = ${#logs[@]} - 1; i >= ${#logs[@]} - excess && i >= 0; i-- )); do' \
|
|
' rm -f "${logs[$i]}"' \
|
|
'done' \
|
|
> $_yay_wrapper
|
|
|
|
chmod +x $_yay_wrapper
|
|
|
|
set --erase _yay_real _yay_wrapper _yay_wrapper_version
|