Merge remote-tracking branch 'origin/main' into refactor/config-settings-renderer
# Conflicts: # functions/__config_settings_draw.fish # functions/__config_settings_draw_subcat.fish # functions/__config_settings_draw_value.fish # tests/functional.fish
This commit is contained in:
+3
-2
@@ -1,6 +1,6 @@
|
||||
# GitIgnore for Fish-config
|
||||
|
||||
# id: gitig-boilerplate-7f0528027e23f210196ae4583c408e5b
|
||||
# id: gitig-boilerplate-a27b89403ff9f0bb3340ede87b42f93e
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ GitIgnore Boilerplate Template │
|
||||
# ╰──────────────────────────────────────────────────────────╯
|
||||
@@ -93,8 +93,9 @@ functions/sponge_*.fish
|
||||
[Aa][nN][Tt][Ii][Gg][Rr][Aa][Vv][Ii][Tt][Yy].[Mm][Dd]
|
||||
.[Aa][Nn][Tt][Ii][Gg][Rr][Aa][Vv]*
|
||||
|
||||
# Matches AGENTS.md, .remember, etc.
|
||||
# Matches AGENTS.md, .agents/ (agy), .remember, etc.
|
||||
[Aa][Gg][Ee][Nn][Tt][Ss].[Mm][Dd]
|
||||
.[Aa][Gg][Ee][Nn][Tt][Ss]*
|
||||
.[Rr][Ee][Mm][Ee][Mm][Bb][Ee][Rr]
|
||||
|
||||
# ──────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -228,16 +228,15 @@ function __tailscale_prepare_completions
|
||||
return 0
|
||||
end
|
||||
|
||||
# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
|
||||
# so we can properly delete any completions provided by another script.
|
||||
# Only do this if the program can be found, or else fish may print some errors; besides,
|
||||
# the existing completions will only be loaded if the program can be found.
|
||||
if type -q "tailscale"
|
||||
# The space after the program name is essential to trigger completion for the program
|
||||
# and not completion of the program name itself.
|
||||
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
||||
complete --do-complete "tailscale " > /dev/null 2>&1
|
||||
end
|
||||
# REMOVED (2026-09-07): Cobra's self-priming block —
|
||||
# if type -q "tailscale"; complete --do-complete "tailscale " >/dev/null 2>&1; end
|
||||
# It existed to force any pre-existing tailscale completions to load so the
|
||||
# `complete -c tailscale -e` below could erase them. From completions/ it has
|
||||
# no job: fish autoloads only the FIRST match on $fish_complete_path, and
|
||||
# $__fish_config_dir/completions precedes /usr/share/fish/vendor_completions.d,
|
||||
# so the vendor file is never sourced and there is nothing to erase. It also
|
||||
# executed the tailscale binary at startup. Verified: completion output is
|
||||
# byte-identical with and without it. See AGENTS/specs/2026-09-07-startup-latency-design.md D2.
|
||||
|
||||
# Remove any pre-existing completions for the program since we will be handling all of them.
|
||||
complete -c tailscale -e
|
||||
@@ -12,6 +12,9 @@
|
||||
# site abbr-integrations: integrations/terminal-abbrs
|
||||
# site abbr-overrides: overrides/key-bindings
|
||||
|
||||
# Abbreviations only expand in the line editor; a script can never use one.
|
||||
status is-interactive; or return
|
||||
|
||||
# Neovim
|
||||
# @category Editors
|
||||
# @desc nvim
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
#
|
||||
# Manage the registry with: auto-pull add / remove / list / status
|
||||
|
||||
# Registers an --on-variable PWD handler that backgrounds a git fetch. In a
|
||||
# script that cd's, that is both wasted work and AGENTS.md Task #4's
|
||||
# credential-prompt hazard fired from a background job.
|
||||
status is-interactive; or return
|
||||
|
||||
# C2 guard: when auto-execution is disabled, do not register the handler.
|
||||
__fish_config_op_enabled (status basename); or exit
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
# Provides bash-style history expansion functions for abbreviations.
|
||||
# These functions are gated by the C3 overrides switch.
|
||||
|
||||
# The six expand_* functions are reachable only through abbr --function
|
||||
# (conf.d/abbr.fish:677-697), i.e. only during interactive expansion.
|
||||
status is-interactive; or return
|
||||
|
||||
# Execute expand_bang_all
|
||||
function expand_bang_all --description 'Execute expand_bang_all'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
# This allows for rapid-fire math without leaving the current shell.
|
||||
# ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
# Defines only fish_user_key_bindings, which fish calls from the interactive
|
||||
# reader and nowhere else.
|
||||
status is-interactive; or return
|
||||
|
||||
function fish_user_key_bindings
|
||||
|
||||
# Custom key chords are opinionated (C3 overrides); skip them entirely
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
# solely in functions/ are never registered and their --on-variable triggers
|
||||
# never fire.
|
||||
|
||||
# Calls __fish_config_sync_logging at every shell start, which mkdir+touches
|
||||
# the C5 sentinel on disk. Its only consumers — the Kitty watcher and the
|
||||
# paru/yay wrappers — are interactive-context; every interactive shell still
|
||||
# refreshes it.
|
||||
status is-interactive; or return
|
||||
|
||||
function __fish_config_logging_changed --on-variable __fish_config_op_logging \
|
||||
--description 'C5 event handler: sync logging state when __fish_config_op_logging changes'
|
||||
__fish_config_sync_logging
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
# site paru-autoexec: autoexec/pkg-wrappers
|
||||
# site paru-logging: logging/pkg-logs
|
||||
|
||||
# Defines nothing; its only effect is generating ~/.local/bin/paru, an
|
||||
# idempotent write every interactive session already performs.
|
||||
status is-interactive; or return
|
||||
|
||||
# Auto-generating a wrapper in ~/.local/bin is opinionated (C2 auto-exec).
|
||||
# Wrapper generation is also gated by C5 (Logging & Capture).
|
||||
__fish_config_op_enabled (status basename) paru-autoexec; or return
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
# Without starship, fish's built-in prompt already emits OSC 133;A
|
||||
# on the prompt line itself, so no wrapper is needed.
|
||||
|
||||
# Defines fish_prompt; no script renders a prompt. Checked before the
|
||||
# op-guard so the builtin short-circuits ahead of three function autoloads.
|
||||
status is-interactive; or return
|
||||
|
||||
# Replacing the prompt is opinionated (C3 overrides)
|
||||
__fish_config_op_enabled (status basename); or return
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@ if not __fish_config_op_enabled (status basename)
|
||||
return
|
||||
end
|
||||
|
||||
# Below the cleanup block on purpose: that branch erases a stale universal
|
||||
# FZF_DEFAULT_OPTS and must keep running wherever it runs today. Everything
|
||||
# past here is fish_color_* for the syntax highlighter, interactive-only.
|
||||
status is-interactive; or return
|
||||
|
||||
# ────────────────────── Syntax highlighting colors ──────────────────────
|
||||
set --global fish_color_autosuggestion 6c7086
|
||||
set --global fish_color_cancel f38ba8
|
||||
|
||||
+21
-9
@@ -18,20 +18,32 @@ if test -f ~/.fish_profile
|
||||
source ~/.fish_profile
|
||||
end
|
||||
|
||||
# Append unique directories to $PATH (fish_add_path handles duplicates automatically)
|
||||
fish_add_path ~/.local/bin
|
||||
fish_add_path ~/Applications/depot_tools
|
||||
# This file is sourced twice per shell on CachyOS (once by the conf.d
|
||||
# autoload, once forced by config.fish to re-win over the distro's own
|
||||
# tricks.fish). The PATH/MANPAGER setup below doesn't need to repeat on
|
||||
# the second pass -- only the functions/aliases further down do, since
|
||||
# those are what re-assert over the distro config. Gate the expensive
|
||||
# calls (fish_add_path, type -q bat) behind a once-per-session guard.
|
||||
# ponytail: per-session guard, not per-value; if this file grows more
|
||||
# expensive one-time setup, extend the same guard rather than adding more.
|
||||
if not set -q __fish_config_tricks_env_applied
|
||||
set -g __fish_config_tricks_env_applied 1
|
||||
|
||||
# Expose user-local man pages
|
||||
if not contains ~/.local/share/man $MANPATH
|
||||
# Append unique directories to $PATH (fish_add_path handles duplicates automatically)
|
||||
fish_add_path ~/.local/bin
|
||||
fish_add_path ~/Applications/depot_tools
|
||||
|
||||
# Expose user-local man pages
|
||||
if not contains ~/.local/share/man $MANPATH
|
||||
set -gx MANPATH ~/.local/share/man $MANPATH
|
||||
end
|
||||
end
|
||||
|
||||
# Format man pages using bat (only if bat is installed)
|
||||
# Overriding $MANPAGER is opinionated (C3 overrides)
|
||||
if type -q bat; and __fish_config_op_enabled (status basename) tricks-manpager
|
||||
# Format man pages using bat (only if bat is installed)
|
||||
# Overriding $MANPAGER is opinionated (C3 overrides)
|
||||
if type -q bat; and __fish_config_op_enabled (status basename) tricks-manpager
|
||||
set -gx MANROFFOPT -c
|
||||
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||
end
|
||||
end
|
||||
|
||||
# Set settings for https://github.com/franciscolourenco/done
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
# site wakatime-autoexec: autoexec/telemetry
|
||||
# site wakatime-hook: integrations/notifications
|
||||
|
||||
# Registers a fish_postexec handler; that event is emitted only by the
|
||||
# interactive reader, so the handler is dead weight in a script.
|
||||
status is-interactive; or return
|
||||
|
||||
# Local modification: opinionated guard (AGENTS.md Task #3). WakaTime
|
||||
# reporting is classified under both C2 auto-execution and C4 integrations;
|
||||
# disabling either category skips registering the hook.
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
# site yay-autoexec: autoexec/pkg-wrappers
|
||||
# site yay-logging: logging/pkg-logs
|
||||
|
||||
# Defines nothing; its only effect is generating ~/.local/bin/yay, an
|
||||
# idempotent write every interactive session already performs.
|
||||
status is-interactive; or return
|
||||
|
||||
# Auto-generating a wrapper in ~/.local/bin is opinionated (C2 auto-exec).
|
||||
# Wrapper generation is also gated by C5 (Logging & Capture).
|
||||
__fish_config_op_enabled (status basename) yay-autoexec; or return
|
||||
|
||||
+3
-4
@@ -46,7 +46,6 @@ The configuration uses a structured file tree:
|
||||
├── conf.d/
|
||||
│ ├── abbr.fish All abbreviations
|
||||
│ ├── autopair.fish Auto-pair brackets and quotes
|
||||
│ ├── cheat.fish cheat.sh tab completions
|
||||
│ ├── done.fish Desktop notifications for long commands
|
||||
│ ├── first_run.fish One-time init: Fisher bootstrap, theme
|
||||
│ ├── key_bindings.fish Custom key bindings and Vi mode
|
||||
@@ -58,14 +57,13 @@ The configuration uses a structured file tree:
|
||||
│ ├── zellij-logging.fish C5 fish_exit handler for zellij
|
||||
│ ├── sponge_privacy.fish Sponge privacy patterns
|
||||
│ ├── starship.fish fish_prompt shell-integration markers
|
||||
│ ├── tailscale.fish Tailscale CLI tab completions
|
||||
│ ├── theme.fish Catppuccin syntax highlight colors
|
||||
│ ├── tricks.fish PATH, bang-bang helpers, bat man pages
|
||||
│ ├── wakatime.fish WakaTime shell hook
|
||||
│ ├── yay-wrapper.fish Auto-generates yay logging wrapper
|
||||
│ └── zoxide.fish Zoxide z/zi integration; overrides cd
|
||||
├── functions/ Custom functions, one per file
|
||||
├── completions/ Tab completion scripts
|
||||
├── completions/ Tab completion scripts, autoloaded on demand
|
||||
├── integrations/
|
||||
│ └── fzf.fish FZF Catppuccin theme and key bindings
|
||||
├── scripts/
|
||||
@@ -245,7 +243,8 @@ Every shell command is reported to WakaTime for time-tracking. Set
|
||||
|
||||
### Tailscale
|
||||
|
||||
Full tab completion for the `tailscale` CLI is provided via `conf.d/tailscale.fish`.
|
||||
Full tab completion for the `tailscale` CLI is provided via
|
||||
`completions/tailscale.fish`, autoloaded on the first `tailscale<TAB>`.
|
||||
|
||||
### Done Notifications
|
||||
|
||||
|
||||
@@ -118,7 +118,8 @@ Every shell command is reported to WakaTime for time-tracking. Set
|
||||
|
||||
### Tailscale
|
||||
|
||||
Full tab completion for the `tailscale` CLI is provided via `conf.d/tailscale.fish`.
|
||||
Full tab completion for the `tailscale` CLI is provided via
|
||||
`completions/tailscale.fish`, autoloaded on the first `tailscale<TAB>`.
|
||||
|
||||
### Done Notifications
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ The configuration uses a structured file tree:
|
||||
├── conf.d/
|
||||
│ ├── abbr.fish All abbreviations
|
||||
│ ├── autopair.fish Auto-pair brackets and quotes
|
||||
│ ├── cheat.fish cheat.sh tab completions
|
||||
│ ├── done.fish Desktop notifications for long commands
|
||||
│ ├── first_run.fish One-time init: Fisher bootstrap, theme
|
||||
│ ├── key_bindings.fish Custom key bindings and Vi mode
|
||||
@@ -47,14 +46,13 @@ The configuration uses a structured file tree:
|
||||
│ ├── zellij-logging.fish C5 fish_exit handler for zellij
|
||||
│ ├── sponge_privacy.fish Sponge privacy patterns
|
||||
│ ├── starship.fish fish_prompt shell-integration markers
|
||||
│ ├── tailscale.fish Tailscale CLI tab completions
|
||||
│ ├── theme.fish Catppuccin syntax highlight colors
|
||||
│ ├── tricks.fish PATH, bang-bang helpers, bat man pages
|
||||
│ ├── wakatime.fish WakaTime shell hook
|
||||
│ ├── yay-wrapper.fish Auto-generates yay logging wrapper
|
||||
│ └── zoxide.fish Zoxide z/zi integration; overrides cd
|
||||
├── functions/ Custom functions, one per file
|
||||
├── completions/ Tab completion scripts
|
||||
├── completions/ Tab completion scripts, autoloaded on demand
|
||||
├── integrations/
|
||||
│ └── fzf.fish FZF Catppuccin theme and key bindings
|
||||
├── scripts/
|
||||
|
||||
@@ -38,9 +38,7 @@ function __config_settings_draw
|
||||
set -l cur_scope $argv[2]
|
||||
set -l vars $argv[3..]
|
||||
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l labels Aliases Auto-exec Overrides Integrations Logging Greeting Master
|
||||
|
||||
|
||||
@@ -41,9 +41,7 @@ function __config_settings_draw_subcat
|
||||
set -l cur_scope $argv[2]
|
||||
set -l category_var $argv[3]
|
||||
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l rows (__config_settings_subcats $category_var)
|
||||
set -l n (count $rows)
|
||||
|
||||
@@ -33,10 +33,7 @@ function __config_settings_draw_value
|
||||
set -l edit_mode $argv[3]
|
||||
set -l edit_buf $argv[4]
|
||||
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
# ── Page row metadata (parallel lists) ────────────────────────────────
|
||||
set -l title
|
||||
|
||||
@@ -27,8 +27,7 @@ function __config_settings_pagetab
|
||||
set -l active $argv[1]
|
||||
set -l iw $argv[2]
|
||||
|
||||
set -l c_hi (set_color --bold white)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
set -l names Universal Session Sponge Paths
|
||||
|
||||
set -l strip ' '
|
||||
|
||||
@@ -28,84 +28,38 @@ function __fish_config_sync_logging --description 'Sync C5 logging state: sentin
|
||||
set config_home "$HOME/.config"
|
||||
end
|
||||
set -l sentinel "$config_home/fish/.logging_disabled"
|
||||
set -l paru_wrapper "$HOME/.local/bin/paru"
|
||||
set -l yay_wrapper "$HOME/.local/bin/yay"
|
||||
set -l wrapper_version 1
|
||||
|
||||
if __fish_config_op_enabled (status current-function)
|
||||
# Logging enabled: remove sentinel and regenerate wrappers if binaries exist
|
||||
# Logging enabled: remove sentinel
|
||||
rm -f $sentinel
|
||||
|
||||
# Restart tmux pipe-pane for the current pane if inside tmux
|
||||
_tmux_pipe_log
|
||||
|
||||
if test -x /usr/bin/paru
|
||||
mkdir -p (dirname $paru_wrapper)
|
||||
printf '%s\n' \
|
||||
'#!/usr/bin/env bash' \
|
||||
"# paru-wrapper-version: $wrapper_version" \
|
||||
'# Auto-generated by conf.d/paru-wrapper.fish — do not edit by hand.' \
|
||||
'# Tees paru 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/paru_$(date +%Y-%m-%d_%H-%M-%S).log"' \
|
||||
'' \
|
||||
'/usr/bin/paru "$@" 2>&1 | tee "$log_file"' \
|
||||
'' \
|
||||
'max_files="${SCROLLBACK_HISTORY_MAX_FILES:-100}"' \
|
||||
'mapfile -t logs < <(ls -1t "$log_dir"/paru_*.log 2>/dev/null)' \
|
||||
'excess=$(( ${#logs[@]} - max_files ))' \
|
||||
'for (( i = ${#logs[@]} - 1; i >= ${#logs[@]} - excess && i >= 0; i-- )); do' \
|
||||
' rm -f "${logs[$i]}"' \
|
||||
'done' \
|
||||
>$paru_wrapper
|
||||
chmod +x $paru_wrapper
|
||||
end
|
||||
|
||||
if test -x /usr/bin/yay
|
||||
mkdir -p (dirname $yay_wrapper)
|
||||
printf '%s\n' \
|
||||
'#!/usr/bin/env bash' \
|
||||
"# yay-wrapper-version: $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
|
||||
end
|
||||
else
|
||||
# Logging disabled: create sentinel and remove any generated wrappers
|
||||
# Logging disabled: create sentinel
|
||||
mkdir -p (dirname $sentinel)
|
||||
touch $sentinel
|
||||
|
||||
if test -f $paru_wrapper
|
||||
and grep -q "# paru-wrapper-version:" $paru_wrapper 2>/dev/null
|
||||
rm -f $paru_wrapper
|
||||
end
|
||||
|
||||
if test -f $yay_wrapper
|
||||
and grep -q "# yay-wrapper-version:" $yay_wrapper 2>/dev/null
|
||||
rm -f $yay_wrapper
|
||||
end
|
||||
|
||||
# Stop tmux pipe-pane for the current pane if inside tmux
|
||||
if set -q TMUX
|
||||
tmux pipe-pane 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
# Delegate paru/yay wrapper (re)generation and removal to the canonical
|
||||
# generators. They resolve the real binary via __fish_real_command
|
||||
# (never /usr/bin-assumed) and independently gate on their own C2/C5
|
||||
# keys, so sourcing them here covers both the enabled-regenerate and
|
||||
# disabled-remove cases without duplicating that logic. Previously this
|
||||
# function carried its own inferior copy (tee instead of a PTY, no
|
||||
# progress-bar rendering, hard-coded /usr/bin/paru|yay), which fought
|
||||
# the canonical generator for the wrapper file on every version-marker
|
||||
# mismatch. See startup-latency-JOB-BRIEF-FINDINGS.md §2.
|
||||
#
|
||||
# Routed through _fish_source_scoped: both files `return` early on
|
||||
# several guard checks, and a sourced `return` exits the *calling*
|
||||
# function, which would otherwise abort this function and skip
|
||||
# whichever of paru/yay hadn't run yet.
|
||||
_fish_source_scoped "$__fish_config_dir/conf.d/paru-wrapper.fish"
|
||||
_fish_source_scoped "$__fish_config_dir/conf.d/yay-wrapper.fish"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# SYNOPSIS
|
||||
# __fish_help_header <name> [args...]
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Prints <name>'s man-page comment header as a help menu on stdout.
|
||||
# Intended as the first statement of a user-facing function's body:
|
||||
#
|
||||
# __fish_help_header (status current-function) $argv; and return 0
|
||||
#
|
||||
# Returns 1 -- printing nothing -- ONLY when args[1] is not a help flag.
|
||||
# Every other outcome, including an unreadable or headerless source
|
||||
# file, prints something and returns 0. That asymmetry is load-bearing:
|
||||
# a return of 1 means "run the real body", and the real body of upgrade
|
||||
# is `paru -Syu --noconfirm`. A parse failure must never return 1.
|
||||
#
|
||||
# Only args[1] is inspected, never the whole list. wake-lock, bkg,
|
||||
# split and spwin take a command to run as their arguments, so
|
||||
# scanning all of $argv would make `wake-lock rsync --help` print
|
||||
# wake-lock's own help instead of running rsync.
|
||||
#
|
||||
# The header is read from the caller's source at call time rather than
|
||||
# from the generated manual, so it cannot go stale between a header
|
||||
# edit and a docs rebuild.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# name The calling function's name, from (status current-function)
|
||||
# args... The caller's $argv, forwarded verbatim
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Help was printed, including the degraded fallback
|
||||
# 1 args[1] is not -h/--help; the caller should carry on
|
||||
#
|
||||
# EXAMPLE
|
||||
# __fish_help_header (status current-function) $argv; and return 0
|
||||
#
|
||||
# NOTES
|
||||
# Section labels are those of the manual SSOT parser in
|
||||
# docs/manualtools.py. CATEGORY, COMPONENT and DEPENDENCIES are build
|
||||
# metadata and are suppressed; SYNOPSIS renders as USAGE and EXAMPLE as
|
||||
# EXAMPLES.
|
||||
function __fish_help_header --argument-names name
|
||||
# First argument only -- see DESCRIPTION.
|
||||
contains -- "$argv[2]" -h --help; or return 1
|
||||
|
||||
set -l c_ttl (set_color --bold)
|
||||
set -l c_sec (set_color --bold brblue)
|
||||
set -l c_rst (set_color normal)
|
||||
set -l miss " No documentation header found. Try: help config $name"
|
||||
|
||||
set -l file (functions -D -- $name 2>/dev/null)
|
||||
if not test -f "$file"
|
||||
# Quoted: set_color yields an EMPTY LIST under TERM=dumb, and an
|
||||
# unquoted empty list in a concatenation annihilates the whole
|
||||
# word -- the title line would silently vanish wherever colour is
|
||||
# off, which is exactly where a test would be reading it.
|
||||
echo "$c_ttl$name$c_rst"
|
||||
echo $miss
|
||||
return 0
|
||||
end
|
||||
|
||||
# Collect the contiguous comment run directly above `function <name>`,
|
||||
# walking backwards. This resolves multi-header files (fish-deps, gi,
|
||||
# y) without reimplementing manualtools._block_identity, and is more
|
||||
# accurate at runtime: in dops.fish it finds the header above
|
||||
# `function docker` rather than attributing it to the file stem.
|
||||
# One blank separator line is tolerated -- sponge_filter_secrets.fish
|
||||
# is the only file that has one, and JOB-BRIEF-FINDINGS.md records it
|
||||
# so this skip is not mistaken for dead code.
|
||||
set -l lines (string split \n -- (command cat $file))
|
||||
set -l pat '^\s*function\s+'(string escape --style=regex -- $name)'(\s|$)'
|
||||
set -l start 0
|
||||
for i in (seq (count $lines))
|
||||
if string match -qr -- $pat $lines[$i]
|
||||
set start $i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
set -l header
|
||||
if test $start -gt 1
|
||||
set -l j (math $start - 1)
|
||||
if test -z (string trim -- "$lines[$j]")
|
||||
set j (math $j - 1)
|
||||
end
|
||||
while test $j -ge 1; and string match -q '#*' -- $lines[$j]
|
||||
set -p header $lines[$j]
|
||||
set j (math $j - 1)
|
||||
end
|
||||
end
|
||||
|
||||
# Render. Comment lines before the first `# LABEL` -- the copyright
|
||||
# preamble -- carry no label and are dropped, matching
|
||||
# manualtools._header_blocks.
|
||||
set -l skip CATEGORY COMPONENT DEPENDENCIES
|
||||
set -l label ""
|
||||
set -l out
|
||||
for line in $header
|
||||
set -l m (string match -r -- '^#\s+([A-Z][A-Z ]*[A-Z])\s*$' $line)
|
||||
if set -q m[2]
|
||||
set label $m[2]
|
||||
contains -- $label $skip; and continue
|
||||
set -l shown (string replace SYNOPSIS USAGE -- $label)
|
||||
set shown (string replace EXAMPLE EXAMPLES -- $shown)
|
||||
# One blank line before a heading, never two: the header's own
|
||||
# `#` separator has usually already emitted one.
|
||||
if set -q out[1]; and test -n (string trim -- "$out[-1]")
|
||||
set -a out ""
|
||||
end
|
||||
set -a out "$c_sec$shown$c_rst"
|
||||
continue
|
||||
end
|
||||
test -n "$label"; or continue
|
||||
contains -- $label $skip; and continue
|
||||
set -l body (string sub -s 2 -- $line)
|
||||
if string match -q ' *' -- $body
|
||||
set -a out " "(string sub -s 4 -- $body)
|
||||
else
|
||||
set -a out (string trim -- $body)
|
||||
end
|
||||
end
|
||||
|
||||
# Trim the trailing blank separator, mirroring
|
||||
# manualtools._trailing_blanks.
|
||||
while set -q out[-1]; and test -z (string trim -- "$out[-1]")
|
||||
set -e out[-1]
|
||||
end
|
||||
|
||||
echo "$c_ttl$name$c_rst"
|
||||
if test (count $out) -eq 0
|
||||
echo $miss
|
||||
else
|
||||
# out[1] is always a heading -- a body line cannot precede the
|
||||
# first label -- so this blank is never doubled.
|
||||
echo ""
|
||||
printf '%s\n' $out
|
||||
end
|
||||
return 0
|
||||
end
|
||||
@@ -0,0 +1,63 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# SYNOPSIS
|
||||
# __fish_palette
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Defines the shared terminal-output colour roles used by the
|
||||
# user-facing functions in this configuration. Declared
|
||||
# --no-scope-shadowing and using a bare `set`, so the variables are
|
||||
# created in the CALLER's scope -- a consumer just calls it and then
|
||||
# interpolates $c_head, $c_err and friends exactly as it did when the
|
||||
# declarations were inline.
|
||||
#
|
||||
# Call it where the local declarations used to sit, once per contiguous
|
||||
# block that needs the palette. set_color runs at call time, so the
|
||||
# values track $TERM exactly as inline declarations did. (Measured:
|
||||
# set_color output is identical across every TERM tested except
|
||||
# TERM=dumb, which yields empty strings, and is unaffected by whether
|
||||
# stdout is a tty or a pipe.)
|
||||
#
|
||||
# A role is a semantic slot, not a colour. c_flag and c_warn are both
|
||||
# yellow but stay separate, as do c_ok and c_accent (both green) --
|
||||
# merging either pair would foreclose ever restyling one without the
|
||||
# other. c_accent is the command name in logs and smart_exit, which
|
||||
# style it green where the rest of the config styles it bold.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# none
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 always
|
||||
#
|
||||
# EXAMPLE
|
||||
# function mytool
|
||||
# __fish_palette
|
||||
# echo "$c_head""Usage:$c_reset $c_cmd""mytool$c_reset"
|
||||
# end
|
||||
#
|
||||
# NOTES
|
||||
# Calling this at top level (outside any function) creates GLOBAL
|
||||
# variables. Every consumer calls it from inside a function, where the
|
||||
# variables stay function-local and do not leak.
|
||||
#
|
||||
# functions/fish_prompt.fish deliberately does NOT use this palette. Its
|
||||
# c_* values are Catppuccin hex strings passed as ARGUMENTS to set_color
|
||||
# (`set_color --bold $c_green`), not captured escape sequences -- colour
|
||||
# inputs rather than rendered output, a different concern.
|
||||
|
||||
function __fish_palette --no-scope-shadowing --description 'Define the shared output colour palette in the caller scope'
|
||||
set c_reset (set_color normal)
|
||||
set c_head (set_color --bold cyan)
|
||||
set c_cmd (set_color --bold)
|
||||
set c_arg (set_color cyan)
|
||||
set c_flag (set_color yellow)
|
||||
set c_warn (set_color yellow)
|
||||
set c_err (set_color red)
|
||||
set c_ok (set_color green)
|
||||
set c_accent (set_color green)
|
||||
set c_dim (set_color brblack)
|
||||
set c_sel (set_color --bold magenta)
|
||||
set c_hi (set_color --bold white)
|
||||
end
|
||||
@@ -31,8 +31,7 @@
|
||||
# EXAMPLE
|
||||
# _agents_init_ensure_gitignore /home/user/myproject "agents-init" "AGENTS/" "/AGENTS.md"
|
||||
function _agents_init_ensure_gitignore
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
if test (count $argv) -lt 3
|
||||
echo (set_color red)"_agents_init_ensure_gitignore: requires <root> <label> <pattern>..."(set_color normal) >&2
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# SYNOPSIS
|
||||
# _fish_source_scoped <file>
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Sources <file> inside its own function-call boundary. `source` runs
|
||||
# in the caller's own scope, so a bare `return` in a sourced file --
|
||||
# used by several conf.d guards as an early exit -- would otherwise
|
||||
# unwind whatever function called `source` directly, not just the
|
||||
# sourced file. Calling through this helper contains it to here.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# file Path to the fish script to source
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 File does not exist (nothing to do)
|
||||
# Exit status of the sourced file otherwise
|
||||
#
|
||||
# EXAMPLE
|
||||
# _fish_source_scoped $__fish_config_dir/conf.d/paru-wrapper.fish
|
||||
function _fish_source_scoped --argument-names file
|
||||
test -f $file; or return 0
|
||||
source $file
|
||||
end
|
||||
@@ -85,14 +85,7 @@
|
||||
# agents-init --plugins
|
||||
# agents-init --quiet
|
||||
function agents-init --description 'scaffold AGENTS/ sub-repo with agent spec files and plugin dirs'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
argparse h/help a/agents p/plugins v/verbose q/quiet s/silent -- $argv
|
||||
or return 1
|
||||
|
||||
@@ -186,14 +186,7 @@
|
||||
# throwaway directory and leave a dangling symlink behind, which is
|
||||
# strictly worse than having had no backup at all.
|
||||
function agents-vault --description 'track curated agent memory in a host-scoped vault repo'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
argparse h/help link push restore status 'adopt=' 'remote=' \
|
||||
v/verbose q/quiet s/silent -- $argv
|
||||
|
||||
@@ -42,14 +42,7 @@
|
||||
# auto-pull list
|
||||
# auto-pull remove qmk_firmware
|
||||
function auto-pull --description 'Manage the auto-pull repository registry'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -q __fish_config_dir; or set -l __fish_config_dir $XDG_CONFIG_HOME/fish
|
||||
set -q __fish_user_dots_path; or set -l __fish_user_dots_path "$XDG_CONFIG_HOME/.user-dots/fish"
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
# bd-pull myuser/myproject
|
||||
# bd-pull rootiest/fish-config
|
||||
function bd-pull --description 'Pull new Gitea issues into local Beads and link them'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if not set -q argv[1]; echo "Need repo owner/name"; return 1; end
|
||||
if not set -q GITEA_TOKEN; echo "\$GITEA_TOKEN not set"; return 1; end
|
||||
|
||||
|
||||
+3
-4
@@ -23,12 +23,11 @@
|
||||
# EXAMPLE
|
||||
# bkg firefox
|
||||
function bkg --description 'Execute bkg'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Check if a command was provided as an argument.
|
||||
if test -z "$argv[1]"
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""bkg$c_reset $c_arg""<command> [arguments...]$c_reset"
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# EXAMPLE
|
||||
# branch feature/new-ui
|
||||
function branch --description 'Switch to or create a git branch'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if not git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||
echo "Not a git repo."
|
||||
return 1
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
# Backwards-compatibility wrapper that delegates to fish-deps status to
|
||||
# report which fish shell dependencies are installed or missing.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `fish-deps status`
|
||||
#
|
||||
# EXAMPLE
|
||||
# check_fish_deps
|
||||
function check_fish_deps --description 'Check all fish-related dependencies'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
fish-deps status
|
||||
end
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
# README.md, ensuring all features and examples are accurate and pruning
|
||||
# obsolete content.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of the `claude` invocation
|
||||
#
|
||||
# EXAMPLE
|
||||
# claude-docs
|
||||
function claude-docs --description 'Claude-code: Sync README with recent changes'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
claude "Analyze the recent changes and update the README.md to ensure all features, setup instructions, and examples are 100% accurate. Prune any obsolete information."
|
||||
end
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
# branch, write a Conventional Commit, run verification, push, and open a
|
||||
# pull request with a manual verification checklist.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of the `claude` invocation
|
||||
#
|
||||
# EXAMPLE
|
||||
# claude-pr
|
||||
function claude-pr --description 'Claude-code: New branch, commit, push, and PR'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
claude "Act as a senior engineer. Execute this sequence: 1. Create a new git branch (kebab-case). 2. Stage changes and write a Conventional Commit message. 3. Self-verify the changes by running relevant build/test commands or linting. 4. Push to remote. 5. Create a PR to 'main' including a summary of changes and a 'Manual Verification' section containing a Markdown checklist (- [ ]) of specific, bite-sized steps required to manually verify the functionality."
|
||||
end
|
||||
|
||||
@@ -11,9 +11,15 @@
|
||||
# Identifies and removes Arch Linux orphan packages using pacman. Logs
|
||||
# package names and versions to ~/.removed_orphans before removal.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 No orphans found, or orphans removed successfully
|
||||
# Nonzero `sudo pacman -Rns` failed
|
||||
#
|
||||
# EXAMPLE
|
||||
# cleanup
|
||||
function cleanup --description 'Log orphans to ~/.removed_orphans and remove them'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
set -l orphans (pacman -Qtdq)
|
||||
if test -n "$orphans"
|
||||
echo "📝 Logging orphans to ~/.removed_orphans..."
|
||||
|
||||
@@ -69,12 +69,7 @@
|
||||
# EXAMPLE
|
||||
# config-settings
|
||||
function config-settings --description 'Interactive TUI for managing fish config settings'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
# ── Argument parsing ──────────────────────────────────
|
||||
for arg in $argv
|
||||
|
||||
@@ -27,14 +27,7 @@
|
||||
# config-update --dry-run
|
||||
# config-update --force
|
||||
function config-update --description 'Pull latest fish config from upstream'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l REMOTE_URL https://git.rootiest.dev/rootiest/fish-config.git
|
||||
set -l CONFIG_DIR ~/.config/fish
|
||||
|
||||
@@ -25,11 +25,7 @@
|
||||
# EXAMPLE
|
||||
# detach rsync -a ./data remote:/backup/
|
||||
function detach --description 'Execute detach'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l show_help 0
|
||||
set -l args
|
||||
|
||||
@@ -38,11 +38,7 @@ function dng2avif --description 'Convert DNG raw to 10-bit HDR AVIF'
|
||||
|
||||
# Help Screen
|
||||
if set -q _flag_help; or test (count $argv) -eq 0 -a -z "$_flag_input"
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dng2avif$c_reset $c_flag""[options]$c_reset $c_dim""[input.dng]$c_reset"
|
||||
echo ""
|
||||
echo "$c_head""Options:$c_reset"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# CATEGORY
|
||||
# 12-ai-and-developer-tools
|
||||
#
|
||||
# DEPENDENCIES
|
||||
# dops
|
||||
#
|
||||
# SYNOPSIS
|
||||
# docker [subcommand] [args...]
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Wrapper for docker that intercepts the ps subcommand and redirects it to
|
||||
# the dops function for enhanced container listing. All other subcommands,
|
||||
# and a bare invocation with no subcommand, are passed through to the real
|
||||
# docker binary.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# subcommand Docker subcommand (ps is redirected to dops)
|
||||
# args... Arguments forwarded to docker or dops
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of dops (for ps), or of the real docker binary otherwise
|
||||
#
|
||||
# EXAMPLE
|
||||
# docker ps
|
||||
# docker
|
||||
function docker --description 'Execute docker, redirecting ps to the enhanced dops listing'
|
||||
if test -z "$argv[1]"
|
||||
command docker
|
||||
return
|
||||
end
|
||||
|
||||
switch $argv[1]
|
||||
case ps
|
||||
dops $argv[2..-1]
|
||||
case '*'
|
||||
command docker $argv[1..-1]
|
||||
end
|
||||
end
|
||||
@@ -30,11 +30,7 @@ function dockup --description 'Pull and restart docker compose containers'
|
||||
|
||||
# Handle help flags
|
||||
if contains -- -h $argv; or contains -- --help $argv
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""dockup$c_reset $c_dim""[DIRECTORY]$c_reset"
|
||||
echo ""
|
||||
echo "$c_head""Options:$c_reset"
|
||||
|
||||
+17
-16
@@ -4,27 +4,28 @@
|
||||
# CATEGORY
|
||||
# 12-ai-and-developer-tools
|
||||
#
|
||||
# DEPENDENCIES
|
||||
# docker
|
||||
#
|
||||
# SYNOPSIS
|
||||
# docker [subcommand] [args...]
|
||||
# dops [args...]
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Wrapper for docker that intercepts the ps subcommand and redirects it to
|
||||
# the dops function for enhanced container listing. All other subcommands are
|
||||
# passed through to the real docker binary.
|
||||
# Enhanced container listing: runs docker ps with a clean custom table
|
||||
# (Names, Image, Status, Ports) instead of docker's noisier default
|
||||
# columns. Extra arguments (e.g. -a) are forwarded to docker ps.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# subcommand Docker subcommand (ps is redirected to dops)
|
||||
# args... Arguments forwarded to docker or dops
|
||||
# args... Arguments forwarded to `docker ps`
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `docker ps`
|
||||
#
|
||||
# EXAMPLE
|
||||
# docker ps
|
||||
function docker --description 'Execute docker'
|
||||
if test -n "$argv[1]"
|
||||
switch $argv[1]
|
||||
case ps
|
||||
dops $argv[2..-1]
|
||||
case '*'
|
||||
command docker $argv[1..-1]
|
||||
end
|
||||
end
|
||||
# dops
|
||||
# dops -a
|
||||
function dops --description 'Enhanced, formatted docker ps listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
command docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' $argv
|
||||
end
|
||||
|
||||
+1
-6
@@ -45,12 +45,7 @@
|
||||
# edit --editor=code --clipboard
|
||||
# edit --text="hello world"
|
||||
function edit --description 'Open files in a terminal or GUI editor with fallbacks'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
# Opinionated guard (C1): fall back to the legacy bare-editor behavior.
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
|
||||
@@ -33,9 +33,14 @@
|
||||
# Displays a styled message indicating that the fast command is unavailable
|
||||
# and suggests using fast-cli instead.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Always
|
||||
#
|
||||
# EXAMPLE
|
||||
# fast
|
||||
function fast --description 'Placeholder for future fast utility'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# ANSI Escape Codes (Standard 16-color palette)
|
||||
set -l bold "\e[1m"
|
||||
set -l italic "\e[3m"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
# fc
|
||||
# fc git
|
||||
function fc --description 'Edit and execute the last command (Bash-style fc)'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
set -l tmpfile (mktemp /tmp/fish_fc.XXXXXX).fish
|
||||
|
||||
if count $argv >/dev/null
|
||||
|
||||
@@ -66,6 +66,13 @@ function fish-deps --description 'Manage fish shell dependencies'
|
||||
_fish_deps_status
|
||||
case install
|
||||
_fish_deps_install $flags
|
||||
case -h --help
|
||||
# Reuse the existing menu rather than the header renderer: it
|
||||
# is richer, and it is already the text the unknown-subcommand
|
||||
# path prints. Previously --help fell into `case '*'` and
|
||||
# exited 1 with "Unknown subcommand: --help".
|
||||
__fish_deps_help
|
||||
return 0
|
||||
case update
|
||||
_fish_deps_update
|
||||
case sync
|
||||
@@ -93,11 +100,7 @@ end
|
||||
# EXAMPLE
|
||||
# __fish_deps_help
|
||||
function __fish_deps_help
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
echo "$c_head""fish-deps$c_reset — manage fish shell dependencies"
|
||||
echo ""
|
||||
|
||||
@@ -11,9 +11,15 @@
|
||||
# Installs or upgrades fzf from git HEAD into ~/.fzf. Pulls the latest
|
||||
# changes if ~/.fzf already exists, or clones the repository if not.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 fzf installed or updated successfully
|
||||
# Nonzero git or the fzf install script failed
|
||||
#
|
||||
# EXAMPLE
|
||||
# fzf-update
|
||||
function fzf-update --description 'Install or upgrade fzf from git HEAD'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if test -d ~/.fzf
|
||||
echo "Updating fzf..."
|
||||
git -C ~/.fzf pull --ff-only
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
# Fetches and prints both the public IPv4 and IPv6 addresses using
|
||||
# icanhazip.com. Shows "Not detected" for any address that times out.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Always (network failures print "Not detected" instead of failing)
|
||||
#
|
||||
# EXAMPLE
|
||||
# gip
|
||||
function gip --description 'Show all public IP addresses'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
echo -n "IPv4: "
|
||||
curl -4 -s --max-time 2 https://icanhazip.com || echo "Not detected"
|
||||
echo -n "IPv6: "
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
# DESCRIPTION
|
||||
# Fetches and prints the machine's public IPv4 address using icanhazip.com.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of curl
|
||||
#
|
||||
# EXAMPLE
|
||||
# gip4
|
||||
function gip4 --wraps='curl' --description 'Get public IPv4 address'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
curl -4 -s https://icanhazip.com
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# EXAMPLE
|
||||
# gip6
|
||||
function gip6 --description 'Get public IPv6 address'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Use -6 to force IPv6 and --fail to catch network errors
|
||||
set -l ip (curl -6 -s --fail https://icanhazip.com 2>/dev/null)
|
||||
|
||||
|
||||
+7
-2
@@ -14,13 +14,18 @@
|
||||
# Searches fish history interactively using fzf, inserts the selected command
|
||||
# into the command line, and copies it to the clipboard via wl-copy.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Command selected and inserted, or fzf was cancelled
|
||||
# 1 Disabled by __fish_config_op_integrations
|
||||
#
|
||||
# EXAMPLE
|
||||
# hist
|
||||
function hist --description 'Search fish history and put it in the prompt'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'hist: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -51,14 +51,7 @@
|
||||
# redirections must be wrapped explicitly, e.g.
|
||||
# jobrunner run sync fish -c 'a | b'.
|
||||
function jobrunner --description 'Manage detached background jobs with tmux or GNU screen'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l subcmds run list attach kill logs help \
|
||||
-r --run -l --list -a --attach -k --kill -o --output -h --help
|
||||
|
||||
@@ -38,14 +38,7 @@
|
||||
# kitty-logging install
|
||||
# kitty-logging status
|
||||
function kitty-logging --description 'Install/manage the fish-config Kitty scrollback watcher'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
set -l cmd $argv[1]
|
||||
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lD ~/projects
|
||||
function lD --description 'List directories only'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --only-dirs --long --icons --color=auto --hyperlink $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# EXAMPLE
|
||||
# ld
|
||||
function ld --description 'Run lazydocker on the current Docker context'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if not type -q docker
|
||||
echo "ld: docker is not installed" >&2
|
||||
return 1
|
||||
|
||||
@@ -13,9 +13,14 @@
|
||||
# files tracked by sbctl. Combines the edit and sign steps into a single
|
||||
# command.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Always (individual step failures are not propagated)
|
||||
#
|
||||
# EXAMPLE
|
||||
# limine-edit
|
||||
function limine-edit --description 'Safely edit and re-verify Limine configuration'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# 1. Open the config with sudoedit
|
||||
sudoedit /boot/limine.conf
|
||||
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
# DESCRIPTION
|
||||
# Locks the current desktop session using loginctl lock-session.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `loginctl lock-session`
|
||||
#
|
||||
# EXAMPLE
|
||||
# lock
|
||||
function lock --wraps='loginctl' --description 'alias lock=loginctl'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
loginctl lock-session
|
||||
end
|
||||
|
||||
+9
-13
@@ -39,8 +39,7 @@
|
||||
function logs --description 'Browse terminal log files interactively with fzf'
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'logs: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
@@ -50,24 +49,21 @@ function logs --description 'Browse terminal log files interactively with fzf'
|
||||
or return 1
|
||||
|
||||
if set -q _flag_help
|
||||
set -l c_accent (set_color green)
|
||||
set -l c_primary (set_color cyan)
|
||||
set -l c_bold (set_color --bold)
|
||||
set -l c_reset (set_color normal)
|
||||
echo "Usage: "$c_accent"logs"$c_reset" ["$c_primary"OPTIONS"$c_reset"]"
|
||||
__fish_palette
|
||||
echo "Usage: "$c_accent"logs"$c_reset" ["$c_arg"OPTIONS"$c_reset"]"
|
||||
echo ""
|
||||
echo "Browse and open terminal log files interactively."
|
||||
echo "Logs sorted newest-first. Type to fuzzy-filter by date or category."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " "$c_primary"-h, --help"$c_reset" Show this help"
|
||||
echo " "$c_primary"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay"
|
||||
echo " "$c_arg"-h, --help"$c_reset" Show this help"
|
||||
echo " "$c_arg"-c, --category"$c_reset" Limit to one category: scrollback, paru, yay"
|
||||
echo ""
|
||||
echo "Keys in fzf:"
|
||||
echo " "$c_primary"Enter"$c_reset" Open in \$PAGER"
|
||||
echo " "$c_primary"Ctrl-E"$c_reset" Open in \$EDITOR"
|
||||
echo " "$c_primary"Ctrl-D"$c_reset" Delete selected log"
|
||||
echo " "$c_primary"Ctrl-C"$c_reset" Quit"
|
||||
echo " "$c_arg"Enter"$c_reset" Open in \$PAGER"
|
||||
echo " "$c_arg"Ctrl-E"$c_reset" Open in \$EDITOR"
|
||||
echo " "$c_arg"Ctrl-D"$c_reset" Delete selected log"
|
||||
echo " "$c_arg"Ctrl-C"$c_reset" Quit"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lsr ~/projects
|
||||
function lsr --description 'Reversed time-sorted listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --oneline --sort=modified --reverse --icons --color=auto --hyperlink $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lss ~/downloads
|
||||
function lss --description 'Size-sorted listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --oneline --long --all --sort=size --icons --color=auto --hyperlink --color-scale=size --color-scale-mode=gradient $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lstree ~/projects/myapp
|
||||
function lstree --description 'Full recursive tree listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --tree --icons --color=auto --hyperlink=auto $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lt ~/projects
|
||||
function lt --description 'Tree listing, depth 2'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --tree --level=2 --icons --color=auto --hyperlink $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -15,9 +15,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# ltr ~/projects
|
||||
function ltr --description 'Reversed time-sorted listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --long --all --sort=modified --icons --hyperlink --color=auto --color-scale=age --color-scale-mode=gradient $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to the listing command
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of eza, lsd, or ls, whichever ran
|
||||
#
|
||||
# EXAMPLE
|
||||
# lx ~/projects
|
||||
function lx --description 'Extension-sorted listing'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if which eza >/dev/null 2>&1
|
||||
eza --long --all --sort=extension --icons --color=auto --hyperlink $argv
|
||||
else if which lsd >/dev/null 2>&1
|
||||
|
||||
+13
-21
@@ -26,31 +26,23 @@
|
||||
# mkcd ~/projects/myapp
|
||||
# mkcd ~/projects/newapp/src
|
||||
function mkcd --description 'Create a directory (with parents) and cd into it'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_rst (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
if contains -- -h $argv; or contains -- --help $argv; or test (count $argv) -eq 0
|
||||
echo "$c_head""Usage:$c_rst $c_cmd""mkcd$c_rst $c_arg""<dir>$c_rst"
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""mkcd$c_reset $c_arg""<dir>$c_reset"
|
||||
echo
|
||||
echo " Create $c_arg""<dir>$c_rst (including missing parents) and cd into it."
|
||||
echo " Create $c_arg""<dir>$c_reset (including missing parents) and cd into it."
|
||||
echo
|
||||
echo "$c_head""Arguments:$c_rst"
|
||||
echo " $c_arg""<dir>$c_rst Directory to create and enter"
|
||||
echo "$c_head""Arguments:$c_reset"
|
||||
echo " $c_arg""<dir>$c_reset Directory to create and enter"
|
||||
echo
|
||||
echo "$c_head""Flags:$c_rst"
|
||||
echo " $c_flag-h$c_rst, $c_flag--help$c_rst Show this help message"
|
||||
echo " $c_flag-s$c_rst, $c_flag--silent$c_rst Suppress directory creation output"
|
||||
echo "$c_head""Flags:$c_reset"
|
||||
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show this help message"
|
||||
echo " $c_flag-s$c_reset, $c_flag--silent$c_reset Suppress directory creation output"
|
||||
echo
|
||||
echo "$c_head""Examples:$c_rst"
|
||||
echo " $c_cmd""mkcd$c_rst $c_arg~/projects/myapp$c_rst"
|
||||
echo " $c_cmd""mkcd$c_rst $c_arg~/projects/myapp$c_rst""$c_dim""; git init$c_rst"
|
||||
echo "$c_head""Examples:$c_reset"
|
||||
echo " $c_cmd""mkcd$c_reset $c_arg~/projects/myapp$c_reset"
|
||||
echo " $c_cmd""mkcd$c_reset $c_arg~/projects/myapp$c_reset""$c_dim""; git init$c_reset"
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -77,8 +69,8 @@ function mkcd --description 'Create a directory (with parents) and cd into it'
|
||||
or return $status
|
||||
|
||||
if test $is_new -eq 1
|
||||
echo "$c_ok""✔$c_rst Created and entered $c_arg$dir$c_rst"
|
||||
echo "$c_ok""✔$c_reset Created and entered $c_arg$dir$c_reset"
|
||||
else
|
||||
echo "$c_warn""→$c_rst $c_arg$dir$c_rst already exists — entered"
|
||||
echo "$c_warn""→$c_reset $c_arg$dir$c_reset already exists — entered"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,11 +41,7 @@
|
||||
# NOTES
|
||||
# Typo abbreviation: url-open (expands to open-url on space/enter).
|
||||
function open-url --description 'Open a URL in the best available web browser'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
argparse h/help s/silent v/verbose -- $argv
|
||||
or return 1
|
||||
|
||||
+1
-5
@@ -28,11 +28,7 @@
|
||||
function p --description 'Put from clipboard'
|
||||
# Check for help flag
|
||||
if contains -- -h $argv; or contains -- --help $argv
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""p$c_reset $c_flag""[OPTIONS]$c_reset"
|
||||
echo ""
|
||||
echo " Pastes content from the system clipboard to stdout."
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
# EXAMPLE
|
||||
# parur
|
||||
function parur --description 'Interactively search and remove an installed package using fzf'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
set -l aur ""
|
||||
if type -q paru
|
||||
set aur paru
|
||||
|
||||
+1
-8
@@ -46,14 +46,7 @@ function pkg --description 'Install or remove packages via the system package ma
|
||||
end
|
||||
|
||||
# ── Colour palette ───────────────────────────────────────────
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_ok (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
# ── Installed-check helper ───────────────────────────────────
|
||||
# Uses only its own arguments — safe to define as an inner function.
|
||||
|
||||
@@ -36,11 +36,7 @@
|
||||
# play-media
|
||||
# play-media --player mpv
|
||||
function play-media --description 'Pick audio/video files with fzf and play them'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
argparse h/help p/player= -- $argv
|
||||
or return 1
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# EXAMPLE
|
||||
# poke ~/projects/new/src/main.fish
|
||||
function poke --description 'touch with automatic parent directory creation'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if test (count $argv) -eq 0
|
||||
echo (set_color red)"poke: no file specified"(set_color normal) >&2
|
||||
return 1
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
# Lists all active TCP listeners on the system using lsof, showing
|
||||
# port numbers and addresses without hostname resolution.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `lsof`
|
||||
#
|
||||
# EXAMPLE
|
||||
# ports
|
||||
function ports --wraps='sudo' --description 'Show active network listeners'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
sudo lsof -iTCP -sTCP:LISTEN -P -n
|
||||
end
|
||||
|
||||
+9
-14
@@ -32,26 +32,21 @@
|
||||
if type -q aichat
|
||||
function qc --wraps aichat --description 'Quick-chat wrapper around aichat (cli role)'
|
||||
if contains -- -h $argv; or contains -- --help $argv
|
||||
set -l c_ttl (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_txt (set_color normal)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_rst (set_color normal)
|
||||
__fish_palette
|
||||
set -l w 59
|
||||
set -l bar (string repeat -n $w ─)
|
||||
# Title line, padded to the box width (plain form drives the math).
|
||||
set -l title " qc — quick-chat: a thin aichat wrapper"
|
||||
set -l pad (string repeat -n (math $w - (string length -- $title)) ' ')
|
||||
echo "$c_dim╭$bar╮$c_rst"
|
||||
echo "$c_dim│$c_rst $c_ttl""qc$c_rst $c_dim—$c_rst quick-chat: a thin $c_cmd""aichat$c_rst wrapper$pad$c_dim│$c_rst"
|
||||
echo "$c_dim╰$bar╯$c_rst"
|
||||
echo " Defaults to the $c_flag'cli'$c_rst role — an AI system prompt tuned"
|
||||
echo " for concise, $c_txt""terminal-friendly$c_rst output."
|
||||
echo "$c_dim╭$bar╮$c_reset"
|
||||
echo "$c_dim│$c_reset $c_head""qc$c_reset $c_dim—$c_reset quick-chat: a thin $c_cmd""aichat$c_reset wrapper$pad$c_dim│$c_reset"
|
||||
echo "$c_dim╰$bar╯$c_reset"
|
||||
echo " Defaults to the $c_flag'cli'$c_reset role — an AI system prompt tuned"
|
||||
echo " for concise, $c_reset""terminal-friendly$c_reset output."
|
||||
echo
|
||||
echo " Accepts every $c_cmd""aichat$c_rst flag; passing $c_flag--role$c_rst/$c_flag-r$c_rst overrides"
|
||||
echo " the default role. $c_cmd""aichat$c_rst's own help follows:"
|
||||
echo "$c_dim$bar$c_rst"
|
||||
echo " Accepts every $c_cmd""aichat$c_reset flag; passing $c_flag--role$c_reset/$c_flag-r$c_reset overrides"
|
||||
echo " the default role. $c_cmd""aichat$c_reset's own help follows:"
|
||||
echo "$c_dim$bar$c_reset"
|
||||
aichat --help | string replace -a aichat qc
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -15,10 +15,15 @@
|
||||
# ARGUMENTS
|
||||
# text... Text to encode; reads from stdin if omitted
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of qrencode, or curl if qrencode is unavailable
|
||||
#
|
||||
# EXAMPLE
|
||||
# qr "https://example.com"
|
||||
# echo "hello" | qr
|
||||
function qr --description 'Generate a QR code from text or pipe'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if type -q qrencode
|
||||
if set -q argv[1]
|
||||
echo $argv | qrencode -t utf8
|
||||
|
||||
+14
-18
@@ -38,31 +38,27 @@
|
||||
# Falls back to random choice if GNU shuf is missing, but shuf is
|
||||
# much faster for files with >1000 lines.
|
||||
function rand_string --description 'Generate random, memorable strings from curated word databases'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_rst (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
if set -q argv[1]; and contains -- $argv[1] -h --help
|
||||
echo "$c_head""Usage:$c_rst $c_cmd""rand_string$c_rst $c_arg""[COMPONENTS/MODIFIERS]...$c_rst"
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""rand_string$c_reset $c_arg""[COMPONENTS/MODIFIERS]...$c_reset"
|
||||
echo
|
||||
echo " Generate random, memorable strings from curated word databases."
|
||||
echo
|
||||
echo "$c_head""Components:$c_rst"
|
||||
echo " $c_arg<category>$c_rst A bundled word list (e.g. adjective, animal, color, name, noun, verb)"
|
||||
echo " $c_arg""digits=<N>$c_rst N random digits (e.g. digits=3 -> 842)"
|
||||
echo " $c_arg""literal=<text>$c_rst A static string component for prefixes/suffixes (e.g. literal=TEST)"
|
||||
echo "$c_head""Components:$c_reset"
|
||||
echo " $c_arg<category>$c_reset A bundled word list (e.g. adjective, animal, color, name, noun, verb)"
|
||||
echo " $c_arg""digits=<N>$c_reset N random digits (e.g. digits=3 -> 842)"
|
||||
echo " $c_arg""literal=<text>$c_reset A static string component for prefixes/suffixes (e.g. literal=TEST)"
|
||||
echo
|
||||
echo "$c_head""Modifiers:$c_rst"
|
||||
echo " $c_flag-s$c_rst, $c_flag--separator=<sep>$c_rst Delimiter for subsequent words (dash, underscore, dot, none)"
|
||||
echo " $c_flag-c$c_rst, $c_flag--case=<casing>$c_rst Casing for subsequent words (lower, upper, title)"
|
||||
echo " $c_flag-h$c_rst, $c_flag--help$c_rst Show usage help"
|
||||
echo "$c_head""Modifiers:$c_reset"
|
||||
echo " $c_flag-s$c_reset, $c_flag--separator=<sep>$c_reset Delimiter for subsequent words (dash, underscore, dot, none)"
|
||||
echo " $c_flag-c$c_reset, $c_flag--case=<casing>$c_reset Casing for subsequent words (lower, upper, title)"
|
||||
echo " $c_flag-h$c_reset, $c_flag--help$c_reset Show usage help"
|
||||
echo
|
||||
echo "$c_head""Examples:$c_rst"
|
||||
echo " $c_cmd""rand_string$c_rst adjective animal"
|
||||
echo " $c_cmd""rand_string$c_rst --case=title color animal --separator=dot digits=4"
|
||||
echo " $c_cmd""rand_string$c_rst literal=TEST --separator=underscore verb noun"
|
||||
echo "$c_head""Examples:$c_reset"
|
||||
echo " $c_cmd""rand_string$c_reset adjective animal"
|
||||
echo " $c_cmd""rand_string$c_reset --case=title color animal --separator=dot digits=4"
|
||||
echo " $c_cmd""rand_string$c_reset literal=TEST --separator=underscore verb noun"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -27,11 +27,7 @@ function replay --description 'Run Bash commands replaying changes in Fish'
|
||||
case -v --version
|
||||
echo "replay, version 1.2.1"
|
||||
case "" -h --help
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""replay$c_reset $c_arg""<commands>$c_reset Run Bash commands replaying changes in Fish"
|
||||
echo "$c_head""Options:$c_reset"
|
||||
echo " $c_flag-v$c_reset or $c_flag--version$c_reset Print version"
|
||||
|
||||
@@ -52,10 +52,7 @@
|
||||
# NOTES
|
||||
# Typo abbreviation: open-repo (expands to repo-open on space/enter).
|
||||
function repo-open --description 'Open the origin remote of the current repo in a browser'
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
argparse -X 0 h/help p/print r/root -- $argv
|
||||
or return 1
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
# sbver
|
||||
# sbver --brief
|
||||
function sbver --description 'Verifies Secure Boot status of EFI binaries using sbctl'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if not type -q sbctl
|
||||
echo "Error: 'sbctl' is not installed."
|
||||
return 1
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
# Turns off the display after a 1-second delay by invoking the KDE
|
||||
# PowerDevil "Turn Off Screen" global shortcut via busctl.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `busctl`
|
||||
#
|
||||
# EXAMPLE
|
||||
# screensleep
|
||||
function screensleep --description 'Turn off the display using KDE PowerDevil'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Optional: 1-second delay to ensure no keystrokes wake it immediately
|
||||
sleep 1
|
||||
busctl --user call \
|
||||
|
||||
@@ -63,10 +63,7 @@ function scrub --description 'Recursively purge OS, editor, and compiler garbage
|
||||
|
||||
# Helper function for help menu text
|
||||
function _scrub_help
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""scrub$c_reset $c_flag""[options]$c_reset"
|
||||
echo
|
||||
|
||||
@@ -44,20 +44,16 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
|
||||
argparse $options -- $argv
|
||||
or return 1
|
||||
|
||||
set -l c_primary (set_color cyan)
|
||||
set -l c_accent (set_color green)
|
||||
set -l c_warn (set_color yellow)
|
||||
set -l c_bold (set_color --bold)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
|
||||
if set -q _flag_help
|
||||
echo -e "Usage: $c_accent"exit"$c_reset [$c_primary""OPTIONS""$c_reset]"
|
||||
echo -e "Usage: $c_accent"exit"$c_reset [$c_arg""OPTIONS""$c_reset]"
|
||||
echo ""
|
||||
echo "Closes the current shell session, automatically archiving the window scrollback."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo -e " $c_primary""-h, --help""$c_reset Show this help message"
|
||||
echo -e " $c_primary""-n, --no-log""$c_reset Exit immediately $c_bold""without""$c_reset saving a scrollback history log"
|
||||
echo -e " $c_arg""-h, --help""$c_reset Show this help message"
|
||||
echo -e " $c_arg""-n, --no-log""$c_reset Exit immediately $c_cmd""without""$c_reset saving a scrollback history log"
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -112,7 +108,7 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
|
||||
end
|
||||
end
|
||||
else
|
||||
echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_bold""no history logs saved.""$c_reset"
|
||||
echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_cmd""no history logs saved.""$c_reset"
|
||||
sleep 0.4
|
||||
end
|
||||
|
||||
|
||||
@@ -29,11 +29,7 @@ function spark --description 'Sparklines'
|
||||
if set --query _flag_version[1]
|
||||
echo "spark, version 1.1.0"
|
||||
else if set --query _flag_help[1]
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_flag (set_color yellow)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""spark$c_reset $c_arg""<numbers ...>$c_reset"
|
||||
echo " stdin | $c_cmd""spark$c_reset"
|
||||
echo "$c_head""Options:$c_reset"
|
||||
|
||||
@@ -29,10 +29,13 @@
|
||||
# split
|
||||
# split -v nvim README.md
|
||||
function split --description 'Run a command in a new terminal split'
|
||||
# -h is --horizontal here (see this function's own ARGUMENTS),
|
||||
# so only the long form may reach the renderer.
|
||||
test "$argv[1]" = --help; and __fish_help_header (status current-function) --help; and return 0
|
||||
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'split: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
# EXAMPLE
|
||||
# # Register with sponge (done automatically by conf.d/sponge_privacy.fish):
|
||||
# set -U -a sponge_filters sponge_filter_secrets
|
||||
|
||||
function sponge_filter_secrets --argument-names command
|
||||
# Find all exported variables with security-sensitive names
|
||||
set -l sensitive_vars (set --names --export | string match --regex -- \
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
# EXAMPLE
|
||||
# spwin
|
||||
function spwin --wraps='~/.config/kitty/spawn-window.sh' --description 'spawn window in kitty or wezterm'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'spwin: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
# Launches Steam with systemd-inhibit to prevent the system from idling
|
||||
# or sleeping during active downloads.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# Exit status of `steam` (via systemd-inhibit)
|
||||
#
|
||||
# EXAMPLE
|
||||
# steam-dl
|
||||
function steam-dl --description 'Run Steam while inhibiting system sleep'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
echo "Inhibiting sleep while Steam downloads..."
|
||||
systemd-inhibit --why="Active Download" --who="User" --what=idle:sleep steam
|
||||
end
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
# EXAMPLE
|
||||
# sudo-toggle
|
||||
function sudo-toggle --description 'Toggle sudo password requirement on/off'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Check the file size using sudo stat to see if our bypass rule is active
|
||||
set -l file_size (sudo stat -c %s /etc/sudoers.d/nofail-toggle 2>/dev/null)
|
||||
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
# zRAM compression ratio, zRAM device details (via zramctl), and
|
||||
# active swap priority (via swapon).
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Always
|
||||
#
|
||||
# EXAMPLE
|
||||
# swapstat
|
||||
function swapstat --description 'View colorized zRAM and swappiness status'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
set -l swappiness (sysctl -n vm.swappiness)
|
||||
set -l zdata (zramctl --bytes --noheadings --output DATA,TOTAL /dev/zram0 2>/dev/null)
|
||||
|
||||
|
||||
+3
-2
@@ -25,10 +25,11 @@
|
||||
# EXAMPLE
|
||||
# tab
|
||||
function tab --description 'Spawn a new tab in the current terminal'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'tab: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
# Kills all detached (unattached) tmux sessions, leaving any currently
|
||||
# attached sessions running.
|
||||
#
|
||||
# EXIT STATUS
|
||||
# 0 Always
|
||||
#
|
||||
# EXAMPLE
|
||||
# tmux-clean
|
||||
function tmux-clean --description 'Kill all tmux sessions except the current one'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Get a list of all session names that are NOT currently attached
|
||||
set sessions (tmux list-sessions -F '#{session_name} #{session_attached}' | string match -rv ' 1$' | string split -f1 ' ')
|
||||
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
# EXAMPLE
|
||||
# upgrade
|
||||
function upgrade --description 'Full system upgrade via paru or yay'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
# Opinionated guard (C4): integrations disabled
|
||||
if not __fish_config_op_enabled (status current-function)
|
||||
set -l c_err (set_color red)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_err"'upgrade: disabled by __fish_config_op_integrations'"$c_reset" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
@@ -22,11 +22,10 @@
|
||||
# EXAMPLE
|
||||
# wake-lock rsync -avz src/ dest/
|
||||
function wake-lock --description 'Run a command while inhibiting system sleep'
|
||||
__fish_help_header (status current-function) $argv; and return 0
|
||||
|
||||
if test (count $argv) -eq 0
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""wake-lock$c_reset $c_arg""[command] [args...]$c_reset"
|
||||
return 1
|
||||
end
|
||||
|
||||
+1
-5
@@ -25,11 +25,7 @@
|
||||
function y --description 'Yank to clipboard'
|
||||
# Check for help flag
|
||||
if contains -- -h $argv; or contains -- --help $argv
|
||||
set -l c_head (set_color --bold cyan)
|
||||
set -l c_cmd (set_color --bold)
|
||||
set -l c_arg (set_color cyan)
|
||||
set -l c_dim (set_color brblack)
|
||||
set -l c_reset (set_color normal)
|
||||
__fish_palette
|
||||
echo "$c_head""Usage:$c_reset $c_cmd""y$c_reset $c_arg""[TEXT]$c_reset or $c_arg""[COMMAND]$c_reset | $c_cmd""y$c_reset"
|
||||
echo ""
|
||||
echo "$c_head""Examples:$c_reset"
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
# Functional checks for foundational config behavior. Sourced inside a
|
||||
# fully-loaded, sandboxed interactive fish session by tests/run-tests.fish
|
||||
# -- see that file for the sandbox setup. Each test_* function returns 0
|
||||
# on pass, non-zero on fail; functional_test_main collects and runs them.
|
||||
|
||||
function test_xdg_defaults
|
||||
test -n "$XDG_CONFIG_HOME" -a -n "$XDG_CACHE_HOME" \
|
||||
-a -n "$XDG_DATA_HOME" -a -n "$XDG_STATE_HOME"
|
||||
end
|
||||
|
||||
function test_path_additions
|
||||
contains -- "$HOME/.local/bin" $PATH
|
||||
end
|
||||
|
||||
function test_cdpath
|
||||
contains -- "$HOME/projects" $CDPATH
|
||||
end
|
||||
|
||||
function test_vi_key_bindings
|
||||
test "$fish_key_bindings" = fish_vi_key_bindings
|
||||
end
|
||||
|
||||
function test_abbreviations_loaded
|
||||
abbr -q n
|
||||
end
|
||||
|
||||
function test_core_functions_defined
|
||||
for f in cat logs config-help fish-deps check_fish_deps config-settings
|
||||
if not functions -q $f
|
||||
echo " missing function: $f"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function test_exit_rewired
|
||||
functions -q exit
|
||||
and functions exit | string match -q '*smart_exit*'
|
||||
end
|
||||
|
||||
function test_op_registry_lookup
|
||||
functions -q __fish_config_op_registry_lookup
|
||||
or return 1
|
||||
set -l tags (__fish_config_op_registry_lookup config cdpath)
|
||||
test $status -eq 0 -a (count $tags) -gt 0
|
||||
end
|
||||
|
||||
function test_privacy_variables
|
||||
test "$DO_NOT_TRACK" = "1" -a "$DISABLE_TELEMETRY" = "1"
|
||||
end
|
||||
|
||||
function test_privacy_op_registry_lookup
|
||||
functions -q __fish_config_op_registry_lookup
|
||||
or return 1
|
||||
set -l tags (__fish_config_op_registry_lookup config privacy)
|
||||
test $status -eq 0 -a "$tags" = "overrides/privacy"
|
||||
end
|
||||
|
||||
function test_op_enabled_fail_open
|
||||
# An identity/site pair with no registry entry must resolve to
|
||||
# enabled -- the documented fail-open default.
|
||||
__fish_config_op_enabled __fish_config_test_never_registered somesite
|
||||
end
|
||||
|
||||
function test_greeting_function_defined
|
||||
functions -q fish_greeting
|
||||
end
|
||||
|
||||
function test_agents_vault_defined
|
||||
for f in agents-vault _agents_vault_dir _agents_repo_slug \
|
||||
_agents_repo_ensure_symlink _agents_repo_sync \
|
||||
_agents_repo_install_tools
|
||||
if not functions -q $f
|
||||
echo " missing function: $f"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function test_wrappers_call_agents_vault
|
||||
functions -q claude; or return 1
|
||||
functions claude | string match -q '*agents-vault*'; or return 1
|
||||
functions -q agy; or return 1
|
||||
functions agy | string match -q '*agents-vault*'
|
||||
end
|
||||
|
||||
function test_vault_dir_honors_override
|
||||
set -l saved
|
||||
set -q __fish_agent_vault_dir; and set saved $__fish_agent_vault_dir
|
||||
set -g __fish_agent_vault_dir /tmp/vault-override-check
|
||||
set -l got (_agents_vault_dir)
|
||||
set -e __fish_agent_vault_dir
|
||||
test (count $saved) -gt 0; and set -g __fish_agent_vault_dir $saved
|
||||
test "$got" = /tmp/vault-override-check
|
||||
end
|
||||
|
||||
function test_draw_line_count_matches_panel_h
|
||||
set -l toggle_vars \
|
||||
__fish_config_op_aliases __fish_config_op_autoexec \
|
||||
__fish_config_op_overrides __fish_config_op_integrations \
|
||||
__fish_config_op_logging __fish_config_op_greeting \
|
||||
__fish_config_opinionated
|
||||
|
||||
set -l lines (__config_settings_draw 0 universal $toggle_vars)
|
||||
if test (count $lines) -ne 16
|
||||
echo " __config_settings_draw: expected 16 lines, got "(count $lines)
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l vlines (__config_settings_draw_value 0 sponge)
|
||||
if test (count $vlines) -ne 16
|
||||
echo " __config_settings_draw_value: expected 16 lines, got "(count $vlines)
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l n (count (__config_settings_subcats __fish_config_op_aliases))
|
||||
set -l slines (__config_settings_draw_subcat 0 universal __fish_config_op_aliases)
|
||||
set -l want (math 7 + $n)
|
||||
if test (count $slines) -ne $want
|
||||
echo " __config_settings_draw_subcat: expected $want lines, got "(count $slines)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function test_diff_redraw_unchanged_lines_are_bare_newlines
|
||||
functions -q __config_settings_diff_redraw; or return 1
|
||||
set -l old (string join \n -- AAA BBB CCC | string collect)
|
||||
set -l new (string join \n -- AAA BBB CCC | string collect)
|
||||
set -l out (__config_settings_diff_redraw "$old" "$new" | string collect -N)
|
||||
test "$out" = \n\n\n
|
||||
end
|
||||
|
||||
function test_diff_redraw_changed_line_is_cleared_and_rewritten
|
||||
functions -q __config_settings_diff_redraw; or return 1
|
||||
set -l old (string join \n -- AAA BBB CCC | string collect)
|
||||
set -l new (string join \n -- AAA XYZ CCC | string collect)
|
||||
set -l out (__config_settings_diff_redraw "$old" "$new" | string collect -N)
|
||||
test "$out" = \n\e\[2K\rXYZ\n\n
|
||||
end
|
||||
|
||||
function functional_test_main
|
||||
set -l names (functions -a | string match 'test_*' | sort)
|
||||
set -l failed 0
|
||||
for name in $names
|
||||
if $name
|
||||
echo " PASS $name"
|
||||
else
|
||||
echo " FAIL $name"
|
||||
set failed (math $failed + 1)
|
||||
end
|
||||
end
|
||||
echo ""
|
||||
echo (math (count $names) - $failed)"/"(count $names)" passed"
|
||||
return $failed
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env fish
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
# Shared assertion and reporting core for tests/test-*.fish.
|
||||
#
|
||||
# One assertion: `check <label> <want> <got>`, string equality. Status
|
||||
# assertions use the two-line form, which is the point -- it can say "I
|
||||
# expected exactly 1", where a pass/fail predicate can only say "non-zero":
|
||||
#
|
||||
# __fish_config_op_cascade __probe_cat
|
||||
# check "all unset -> enabled" 0 $status
|
||||
#
|
||||
# That distinction matters here: __fish_variable_check returns four distinct
|
||||
# codes (0 truthy, 1 falsy, 2 unset/empty, 3 unrecognized) and the cascade's
|
||||
# behavior depends on telling 2 and 3 apart from 1.
|
||||
#
|
||||
# Boolean assertions use the idiom the vault suite already uses throughout:
|
||||
#
|
||||
# check "label" true (some-test; and echo true; or echo false)
|
||||
|
||||
set -g TESTS_RUN 0
|
||||
set -g TESTS_FAILED 0
|
||||
|
||||
# The driver always sets this; the fallback is for running a suite by hand.
|
||||
if set -q FISH_CONFIG_TEST_ROOT
|
||||
set -g repo_root $FISH_CONFIG_TEST_ROOT
|
||||
else
|
||||
set -g repo_root (realpath (dirname (status filename))/..)
|
||||
end
|
||||
|
||||
function section
|
||||
echo ""
|
||||
echo "== $argv[1] =="
|
||||
end
|
||||
|
||||
function check --argument-names label want got
|
||||
set -g TESTS_RUN (math $TESTS_RUN + 1)
|
||||
if test "$want" = "$got"
|
||||
echo " PASS $label"
|
||||
else
|
||||
echo " FAIL $label"
|
||||
echo " want: $want"
|
||||
echo " got: $got"
|
||||
set -g TESTS_FAILED (math $TESTS_FAILED + 1)
|
||||
end
|
||||
end
|
||||
|
||||
function report
|
||||
echo ""
|
||||
echo (math $TESTS_RUN - $TESTS_FAILED)"/$TESTS_RUN passed"
|
||||
if set -q FISH_CONFIG_TEST_COUNTS
|
||||
echo "$TESTS_RUN $TESTS_FAILED" >>$FISH_CONFIG_TEST_COUNTS
|
||||
end
|
||||
# Explicit terminal status, never a trailing `if` (AGENTS.md item 5).
|
||||
# This is form, not a bug fix: fish clamps `exit`/`return` to 255 rather
|
||||
# than wrapping mod 256, so `exit $TESTS_FAILED` could not have produced
|
||||
# a false green. Verified: `fish -c 'exit 256'` -> 255, while
|
||||
# `sh -c 'exit 256'` -> 0. A boolean is still the right shape -- it
|
||||
# composes with `and`/`or`, which a raw count does not.
|
||||
test $TESTS_FAILED -eq 0
|
||||
end
|
||||
@@ -0,0 +1,162 @@
|
||||
#!/usr/bin/env fish
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
# Byte-identity harness for the shared output palette (__fish_palette).
|
||||
#
|
||||
# Compares rendered output of every colour-bearing function between a
|
||||
# pristine checkout of a baseline git ref and the current working tree.
|
||||
# This is a one-time acceptance harness, not part of run-tests.fish's
|
||||
# permanent suite -- the permanent check lives in tests/functional.fish.
|
||||
#
|
||||
# Usage:
|
||||
# fish tests/palette-bytes.fish [--baseline REF] byte-diff stdout+stderr
|
||||
# fish tests/palette-bytes.fish --structural diff-shape assertion
|
||||
# fish tests/palette-bytes.fish --startup startup medians
|
||||
#
|
||||
# Both sandboxes get an isolated XDG_CONFIG_HOME carrying a copy of the
|
||||
# working tree's fish_variables. That file is gitignored, so `git archive`
|
||||
# omits it; without it __fish_config_op_enabled is unresolvable and every
|
||||
# opinionated-guarded function silently short-circuits.
|
||||
|
||||
set -l repo (realpath (dirname (status filename))/..)
|
||||
set -l mode bytes
|
||||
set -l baseline main
|
||||
for i in (seq (count $argv))
|
||||
switch $argv[$i]
|
||||
case --structural; set mode structural
|
||||
case --startup; set mode startup
|
||||
case --baseline; set baseline $argv[(math $i + 1)]
|
||||
end
|
||||
end
|
||||
|
||||
set -l tmp (mktemp -d)
|
||||
function __pb_cleanup --on-event fish_exit --inherit-variable tmp
|
||||
test -n "$tmp"; and rm -rf $tmp
|
||||
end
|
||||
|
||||
# ── Build the two sandboxes ────────────────────────────────────────────
|
||||
set -l A $tmp/base/fish # pristine baseline ref
|
||||
set -l B $tmp/work/fish # current working tree
|
||||
mkdir -p $A $B
|
||||
git -C $repo archive $baseline | tar -x -C $A
|
||||
or begin
|
||||
echo "palette-bytes: cannot archive baseline ref '$baseline'" >&2
|
||||
exit 2
|
||||
end
|
||||
for d in functions conf.d completions integrations themes data
|
||||
test -d $repo/$d; and cp -r $repo/$d $B/
|
||||
end
|
||||
cp $repo/config.fish $B/ 2>/dev/null
|
||||
# fish_variables is gitignored -- copy it into BOTH sandboxes by hand.
|
||||
for d in $A $B
|
||||
cp $repo/fish_variables $d/ 2>/dev/null
|
||||
end
|
||||
# qc --help shells out to aichat; stub it so its colour path is reachable.
|
||||
set -l stub $tmp/stub
|
||||
mkdir -p $stub
|
||||
printf '#!/bin/sh\necho "aichat stub"\n' >$stub/aichat
|
||||
chmod +x $stub/aichat
|
||||
|
||||
# ── The cases ──────────────────────────────────────────────────────────
|
||||
# 25 --help paths (every converted function that has one) plus 4 error
|
||||
# paths, two of which write to stderr. Side-effect-free by construction:
|
||||
# --help returns before doing work, and each error path fails on argument
|
||||
# validation. Do NOT add a case that mutates the filesystem.
|
||||
set -l cases \
|
||||
"agents-init --help" "agents-vault --help" "auto-pull --help" \
|
||||
"config-settings --help" "config-update --help" "detach --help" \
|
||||
"dng2avif --help" "dockup --help" "edit --help" "jobrunner --help" \
|
||||
"kitty-logging --help" "logs --help" "mkcd --help" "open-url --help" \
|
||||
"p --help" "pkg --help" "play-media --help" "qc --help" \
|
||||
"rand_string --help" "replay --help" "repo-open --help" "scrub --help" \
|
||||
"smart_exit --help" "spark --help" "y --help" \
|
||||
"mkcd" "auto-pull remove __no_such_repo__" \
|
||||
"agents-init --no-such-flag" "pkg __no_such_subcommand__"
|
||||
|
||||
function __pb_run --argument-names cfg stub cmd out
|
||||
env XDG_CONFIG_HOME=(dirname $cfg) PATH="$stub:$PATH" TERM=xterm-256color \
|
||||
HOME=$HOME fish -c "$cmd" >$out.out 2>$out.err
|
||||
end
|
||||
|
||||
# ── Mode: bytes ────────────────────────────────────────────────────────
|
||||
if test $mode = bytes
|
||||
echo "== palette byte-identity vs $baseline =="
|
||||
set -l failed 0
|
||||
set -l n 0
|
||||
for cmd in $cases
|
||||
set n (math $n + 1)
|
||||
__pb_run $A $stub "$cmd" $tmp/a$n
|
||||
__pb_run $B $stub "$cmd" $tmp/b$n
|
||||
set -l so ok
|
||||
set -l se ok
|
||||
cmp -s $tmp/a$n.out $tmp/b$n.out; or set so DIFF
|
||||
cmp -s $tmp/a$n.err $tmp/b$n.err; or set se DIFF
|
||||
if test $so = DIFF -o $se = DIFF
|
||||
set failed (math $failed + 1)
|
||||
printf ' FAIL %-34s stdout=%s stderr=%s\n' "$cmd" $so $se
|
||||
test $so = DIFF; and diff -u (xxd $tmp/a$n.out | psub) (xxd $tmp/b$n.out | psub) | head -12
|
||||
test $se = DIFF; and diff -u (xxd $tmp/a$n.err | psub) (xxd $tmp/b$n.err | psub) | head -12
|
||||
else
|
||||
printf ' ok %-34s (%s B out, %s B err)\n' "$cmd" (wc -c <$tmp/a$n.out | string trim) (wc -c <$tmp/a$n.err | string trim)
|
||||
end
|
||||
end
|
||||
echo (math $n - $failed)"/$n cases byte-identical"
|
||||
test $failed -eq 0
|
||||
exit $status
|
||||
end
|
||||
|
||||
# ── Mode: structural ───────────────────────────────────────────────────
|
||||
# For files converted WITHOUT drift renames, the whole diff must be
|
||||
# declaration removals plus inserted __fish_palette calls. If that holds,
|
||||
# the file's output strings are provably untouched.
|
||||
if test $mode = structural
|
||||
echo "== structural diff shape vs $baseline =="
|
||||
set -l bad 0
|
||||
for f in (git -C $repo diff --name-only $baseline -- functions/)
|
||||
# fish_prompt.fish keeps its own hex palette -- see Task 10.
|
||||
string match -q '*fish_prompt.fish' $f; and continue
|
||||
# __fish_palette.fish is the palette itself: a new file, so its diff
|
||||
# is 100% additions and can never be "purely structural". Skipping it
|
||||
# is not a loosening -- it declares the colours rather than rendering
|
||||
# any, and tests/functional.fish asserts its 12 roles directly.
|
||||
string match -q '*__fish_palette.fish' $f; and continue
|
||||
set -l offenders
|
||||
for line in (git -C $repo diff -U0 $baseline -- $f | string match -r '^[+-][^+-].*')
|
||||
set -l body (string sub -s 2 -- $line)
|
||||
string match -qr '^\s*set -l c_[a-z]+\s+\(set_color[^)]*\)\s*$' -- $body; and continue
|
||||
string match -qr '^\s*__fish_palette\s*$' -- $body; and continue
|
||||
set -a offenders $line
|
||||
end
|
||||
if test (count $offenders) -gt 0
|
||||
set bad (math $bad + 1)
|
||||
echo " NOT PURELY STRUCTURAL $f"
|
||||
printf ' %s\n' $offenders[1..3]
|
||||
end
|
||||
end
|
||||
if test $bad -eq 0
|
||||
echo " all changed files are purely structural"
|
||||
else
|
||||
echo " $bad file(s) changed rendering text -- expected only for the drift-rename batch"
|
||||
end
|
||||
test $bad -eq 0
|
||||
exit $status
|
||||
end
|
||||
|
||||
# ── Mode: startup ──────────────────────────────────────────────────────
|
||||
echo "== fish -c true, 31 interleaved pairs, median =="
|
||||
set -l ta
|
||||
set -l tb
|
||||
for i in (seq 31)
|
||||
set -l s (date +%s%N)
|
||||
env XDG_CONFIG_HOME=$tmp/base fish -c true >/dev/null 2>&1
|
||||
set -a ta (math "("(date +%s%N)" - $s) / 1000")
|
||||
set s (date +%s%N)
|
||||
env XDG_CONFIG_HOME=$tmp/work fish -c true >/dev/null 2>&1
|
||||
set -a tb (math "("(date +%s%N)" - $s) / 1000")
|
||||
end
|
||||
set -l sa (printf '%s\n' $ta | sort -n)
|
||||
set -l sb (printf '%s\n' $tb | sort -n)
|
||||
printf ' baseline median=%.2f ms p10=%.2f p90=%.2f\n' (math $sa[16]/1000) (math $sa[4]/1000) (math $sa[28]/1000)
|
||||
printf ' working median=%.2f ms p10=%.2f p90=%.2f\n' (math $sb[16]/1000) (math $sb[4]/1000) (math $sb[28]/1000)
|
||||
echo " (p10-p90 spread is ~15 ms; treat any delta inside it as noise)"
|
||||
+139
-53
@@ -4,15 +4,19 @@
|
||||
#
|
||||
# CI test runner for this fish configuration.
|
||||
# 1. Syntax-lints every tracked .fish file (fish -n).
|
||||
# 2. Copies the config-relevant files into a throwaway sandbox (never
|
||||
# the live checkout -- this repo doubles as a real ~/.config/fish,
|
||||
# so a symlinked sandbox would let universal-variable writes like
|
||||
# first-run's escape into the real, gitignored fish_variables file)
|
||||
# and loads it as an isolated interactive session.
|
||||
# 3. Runs the functional checks in tests/functional.fish inside that
|
||||
# loaded session.
|
||||
# 4. Runs tests/test-agents-vault.fish as its own process; that suite
|
||||
# builds its own throwaway repos and needs no loaded config.
|
||||
# 2. Discovers tests/test-*.fish and reads the mode each suite declares
|
||||
# in its own header (`# MODE: isolated` or `# MODE: in-session`).
|
||||
# 3. Runs each isolated suite as its own --no-config fish process with
|
||||
# throwaway XDG dirs.
|
||||
# 4. Sources every in-session suite into ONE sandboxed interactive fish
|
||||
# session built from a copy of this config (never the live checkout
|
||||
# -- this repo doubles as a real ~/.config/fish, so a symlinked
|
||||
# sandbox would let universal-variable writes like first-run's escape
|
||||
# into the real, gitignored fish_variables file).
|
||||
# 5. Sums the per-suite assertion counts and reports a total.
|
||||
#
|
||||
# Assertions come from tests/lib.fish (section/check/report); suites are
|
||||
# never special-cased here by name.
|
||||
#
|
||||
# Usage: fish tests/run-tests.fish
|
||||
|
||||
@@ -42,72 +46,154 @@ if test $lint_failed -ne 0
|
||||
set overall_failed 1
|
||||
end
|
||||
|
||||
# ---- Phase 2: isolated load + functional checks --------------------------
|
||||
echo ""
|
||||
echo "== Sandboxed load + functional checks =="
|
||||
|
||||
set -l sandbox (mktemp -d)
|
||||
set -l sandbox_cfg $sandbox/xdgcfg/fish
|
||||
mkdir -p $sandbox_cfg
|
||||
# path-setup only adds directories that already exist (fish_add_path is a
|
||||
# no-op on missing paths), so give it $HOME/.local/bin to find.
|
||||
mkdir -p $sandbox/home/.local/bin
|
||||
|
||||
cp $repo_root/config.fish $sandbox_cfg/
|
||||
test -f $repo_root/fish_plugins
|
||||
and cp $repo_root/fish_plugins $sandbox_cfg/
|
||||
for d in functions conf.d completions integrations themes data
|
||||
test -d $repo_root/$d
|
||||
and cp -r $repo_root/$d $sandbox_cfg/
|
||||
# ---- Phase 2: discover suites --------------------------------------------
|
||||
# Mode is declared by the suite, not by this driver. Detection is
|
||||
# case-insensitive so a near-miss like "# Mode: in-session" is caught rather
|
||||
# than silently read as "no marker"; the comparison is exact so only the two
|
||||
# real spellings are accepted. Absence means isolated, the safe default -- a
|
||||
# suite that forgets the marker gets its own clean process instead of being
|
||||
# injected into a loaded session, and no typo can ever promote a suite into
|
||||
# in-session. Duplicate markers resolve first-match-wins.
|
||||
set -l isolated_suites
|
||||
set -l session_suites
|
||||
for f in (find $script_dir -name 'test-*.fish' | sort)
|
||||
set -l decl (grep -im1 '^# *mode:' $f)
|
||||
if test -z "$decl"
|
||||
set -a isolated_suites $f
|
||||
else if test "$decl" = "# MODE: in-session"
|
||||
set -a session_suites $f
|
||||
else if test "$decl" = "# MODE: isolated"
|
||||
set -a isolated_suites $f
|
||||
else
|
||||
echo " FAIL "(basename $f)": unrecognized mode declaration: $decl" >&2
|
||||
set overall_failed 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l err_file (mktemp)
|
||||
env -i \
|
||||
set -l counts (mktemp)
|
||||
|
||||
# ---- Phase 3: isolated suites --------------------------------------------
|
||||
# HOME is deliberately NOT overridden here. Read this before "improving" it.
|
||||
#
|
||||
# Overriding XDG_CONFIG_HOME/XDG_DATA_HOME plus --no-config is what makes these
|
||||
# runs isolated: the universal-variable file fish can reach is a fresh empty
|
||||
# one, and no config.fish/conf.d is loaded. Without that, an "isolated" suite
|
||||
# runs against the user's LIVE config and real universal variables -- this repo
|
||||
# doubles as a real ~/.config/fish -- so a guard test doing
|
||||
# `set -e __fish_config_op_logging` would erase a real universal variable out of
|
||||
# the running shell. Measured: $__fish_config_op_registry_keys has 65 entries
|
||||
# under a plain `fish`, 0 under `fish --no-config`.
|
||||
#
|
||||
# `env -i HOME=$sandbox` was tried and REJECTED. It looks strictly more
|
||||
# hermetic, but test-agents-vault.fish's hermeticity floor snapshots the real
|
||||
# $HOME/.claude/memory and $HOME/.gemini/antigravity-cli and asserts them
|
||||
# unchanged at the end. Point HOME at a sandbox and both snapshots read "absent"
|
||||
# before and after: the assertions still pass while asserting nothing. A change
|
||||
# that turns a real assertion into a tautology without turning anything red is
|
||||
# the worst failure mode a test harness has. Keeping HOME real is what keeps
|
||||
# those two assertions biting.
|
||||
#
|
||||
# Overriding XDG_DATA_HOME is a hermeticity gain on top of the isolation:
|
||||
# _agents_vault_dir falls back to
|
||||
# ${XDG_DATA_HOME:-$HOME/.local/share}/agent-vault, so a vault path that no test
|
||||
# overrode lands in a temp dir instead of the user's real ~/.local/share.
|
||||
for suite in $isolated_suites
|
||||
echo ""
|
||||
echo "== "(string replace $repo_root/ '' $suite)" =="
|
||||
set -l xdg (mktemp -d)
|
||||
env XDG_CONFIG_HOME=$xdg/cfg XDG_DATA_HOME=$xdg/data \
|
||||
FISH_CONFIG_TEST_ROOT=$repo_root FISH_CONFIG_TEST_COUNTS=$counts \
|
||||
fish --no-config $suite
|
||||
if test $status -ne 0
|
||||
set overall_failed 1
|
||||
end
|
||||
command rm -rf $xdg
|
||||
end
|
||||
|
||||
# ---- Phase 4: in-session suites ------------------------------------------
|
||||
# All in-session suites share ONE sandboxed interactive session: building it
|
||||
# (copying the config, starting fish -i) is the expensive part.
|
||||
#
|
||||
# The config is COPIED, never symlinked. This repo doubles as a real
|
||||
# ~/.config/fish, so a symlinked sandbox would let universal-variable writes
|
||||
# like first-run's escape into the real, gitignored fish_variables file.
|
||||
if test (count $session_suites) -gt 0
|
||||
echo ""
|
||||
echo "== Sandboxed load + session checks =="
|
||||
|
||||
set -l sandbox (mktemp -d)
|
||||
set -l sandbox_cfg $sandbox/xdgcfg/fish
|
||||
mkdir -p $sandbox_cfg
|
||||
# path-setup only adds directories that already exist (fish_add_path is a
|
||||
# no-op on missing paths), so give it $HOME/.local/bin to find.
|
||||
mkdir -p $sandbox/home/.local/bin
|
||||
|
||||
# Every utility below goes through `command`. This driver runs under the
|
||||
# very config it tests, which shadows these: `cp` is an alias for `cp -i`,
|
||||
# `rm` is a trash wrapper, `cat` resolves to bat. Only `cp` is an actual
|
||||
# hazard today -- `-i` on a non-empty destination reads EOF in a
|
||||
# non-interactive runner and SILENTLY SKIPS the copy while exiting 0,
|
||||
# which would leave the sandbox missing config files and report success.
|
||||
# `rm -rf` and `cat` were measured and behave correctly as-is (the rm
|
||||
# wrapper bails to `command rm` on any non-recursive flag, so -rf really
|
||||
# deletes and does not trash). Prefixed anyway: a test runner must not
|
||||
# depend on the configuration under test.
|
||||
command cp $repo_root/config.fish $sandbox_cfg/
|
||||
test -f $repo_root/fish_plugins
|
||||
and command cp $repo_root/fish_plugins $sandbox_cfg/
|
||||
for d in functions conf.d completions integrations themes data
|
||||
test -d $repo_root/$d
|
||||
and command cp -r $repo_root/$d $sandbox_cfg/
|
||||
end
|
||||
|
||||
set -l srcs
|
||||
for s in $session_suites
|
||||
set -a srcs "source $s;"
|
||||
end
|
||||
|
||||
set -l err_file (mktemp)
|
||||
env -i \
|
||||
HOME=$sandbox/home \
|
||||
XDG_CONFIG_HOME=$sandbox/xdgcfg \
|
||||
PATH="$PATH" \
|
||||
TERM=xterm \
|
||||
__fish_config_op_autoexec=off \
|
||||
fish -i -c "source $repo_root/tests/functional.fish; functional_test_main" \
|
||||
FISH_CONFIG_TEST_ROOT=$repo_root \
|
||||
FISH_CONFIG_TEST_COUNTS=$counts \
|
||||
fish -i -c "source $repo_root/tests/lib.fish; $srcs report" \
|
||||
2>$err_file
|
||||
set -l functional_status $status
|
||||
set -l session_status $status
|
||||
|
||||
set -l stderr_out (cat $err_file)
|
||||
rm -rf $sandbox $err_file
|
||||
set -l stderr_out (command cat $err_file)
|
||||
command rm -rf $sandbox $err_file
|
||||
|
||||
if test -n "$stderr_out"
|
||||
if test -n "$stderr_out"
|
||||
# Diagnostic only, not a gate: on machines with vendor fish configs
|
||||
# (e.g. CachyOS's cachyos-fish-config, which this repo's config.fish
|
||||
# sources when present) unrelated vendor warnings can land here. Real
|
||||
# breakage in this repo's own code is caught by the assertions below.
|
||||
# breakage in this repo's own code is caught by the assertions.
|
||||
echo " Session stderr output (informational):"
|
||||
printf '%s\n' $stderr_out
|
||||
end
|
||||
end
|
||||
|
||||
if test $functional_status -ne 0
|
||||
if test $session_status -ne 0
|
||||
set overall_failed 1
|
||||
end
|
||||
end
|
||||
|
||||
# ---- Phase 3: hermetic vault helper tests --------------------------------
|
||||
# Run as its own fish process rather than inside the sandboxed session:
|
||||
# the suite builds its own throwaway git repos and binds the vault, claude
|
||||
# and agy roots to them, so it needs no loaded config and must never see
|
||||
# the real ~/.claude.
|
||||
echo ""
|
||||
echo "== Vault helper tests =="
|
||||
fish $repo_root/tests/test-agents-vault.fish
|
||||
if test $status -ne 0
|
||||
set overall_failed 1
|
||||
# ---- Phase 5: totals -----------------------------------------------------
|
||||
set -l total_run 0
|
||||
set -l total_failed 0
|
||||
for line in (command cat $counts)
|
||||
set -l parts (string split ' ' -- $line)
|
||||
set total_run (math $total_run + $parts[1])
|
||||
set total_failed (math $total_failed + $parts[2])
|
||||
end
|
||||
command rm -f $counts
|
||||
|
||||
# ---- Phase 4: config-settings render golden ------------------------------
|
||||
# Byte-identity gate for the TUI's three draw functions. Runs as its own
|
||||
# process: like the vault suite it builds its own throwaway
|
||||
# HOME/XDG_CONFIG_HOME sandbox and needs no loaded config.
|
||||
echo ""
|
||||
echo "== config-settings render golden =="
|
||||
fish $repo_root/tests/config-settings-render.fish
|
||||
if test $status -ne 0
|
||||
echo "TOTAL: "(math $total_run - $total_failed)"/$total_run assertions passed"
|
||||
if test $total_failed -ne 0
|
||||
set overall_failed 1
|
||||
end
|
||||
|
||||
|
||||
@@ -8,12 +8,9 @@
|
||||
#
|
||||
# Usage: fish tests/test-agents-vault.fish
|
||||
|
||||
set -l here (realpath (dirname (status filename)))
|
||||
set -g repo_root (realpath $here/..)
|
||||
source (realpath (dirname (status filename)))/lib.fish
|
||||
set -p fish_function_path $repo_root/functions
|
||||
|
||||
set -g TESTS_RUN 0
|
||||
set -g TESTS_FAILED 0
|
||||
set -g TMPDIRS
|
||||
|
||||
# The suite is hermetic against $HOME and ~/.claude, but it was not
|
||||
@@ -50,18 +47,6 @@ set -gx GIT_CONFIG_VALUE_0 false
|
||||
set -gx GIT_CONFIG_KEY_1 init.defaultBranch
|
||||
set -gx GIT_CONFIG_VALUE_1 main
|
||||
|
||||
function check --argument-names label want got
|
||||
set -g TESTS_RUN (math $TESTS_RUN + 1)
|
||||
if test "$want" = "$got"
|
||||
echo " PASS $label"
|
||||
else
|
||||
echo " FAIL $label"
|
||||
echo " want: $want"
|
||||
echo " got: $got"
|
||||
set -g TESTS_FAILED (math $TESTS_FAILED + 1)
|
||||
end
|
||||
end
|
||||
|
||||
# Failure injection that survives uid 0.
|
||||
#
|
||||
# These fixtures used to force a failure with `chmod 500` on a parent
|
||||
@@ -1995,6 +1980,4 @@ set -e __fish_agent_vault_claude_home
|
||||
set -e __fish_agent_vault_agy_root
|
||||
|
||||
cleanup
|
||||
echo ""
|
||||
echo (math $TESTS_RUN - $TESTS_FAILED)"/$TESTS_RUN passed"
|
||||
exit $TESTS_FAILED
|
||||
report
|
||||
|
||||
@@ -99,6 +99,11 @@ end
|
||||
# Sourced, not autoloaded: XDG_CONFIG_HOME points at the empty sandbox. Only
|
||||
# the draw path is ever called -- __config_settings_apply and
|
||||
# __config_settings_set_value are defined here and never invoked.
|
||||
# __fish_palette is sourced too: the draw functions call it (instead of
|
||||
# declaring $c_head/$c_dim/etc. inline) and it doesn't match the
|
||||
# __config_settings_* glob, so without this line every draw function's
|
||||
# colors silently unset and the golden loses all its escape sequences.
|
||||
source $repo/functions/__fish_palette.fish
|
||||
for f in $repo/functions/__config_settings_*.fish
|
||||
source $f
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user