style: format fish files with fish_indent

This commit is contained in:
2026-09-09 20:27:48 -04:00
parent 2dc978e719
commit e40d67df59
58 changed files with 1184 additions and 1015 deletions
+11 -11
View File
@@ -25,19 +25,19 @@ function __auto_source_fallback_venv --on-variable PWD
if set -q DIRENV_DIR; or test -e ".envrc"
return
end
# 2. If we are already in a venv, check if we've left its tree
if set -q VIRTUAL_ENV
# Check if the current PWD is still within the directory that owns the venv
# (Assuming the venv is at the root of the project)
set -l venv_root (string replace -r '/.venv$' '' $VIRTUAL_ENV)
if not string match -q "$venv_root*" "$PWD"
type -q deactivate; and deactivate
end
return
if set -q VIRTUAL_ENV
# Check if the current PWD is still within the directory that owns the venv
# (Assuming the venv is at the root of the project)
set -l venv_root (string replace -r '/.venv$' '' $VIRTUAL_ENV)
if not string match -q "$venv_root*" "$PWD"
type -q deactivate; and deactivate
end
# 3. Only source the venv if we aren't already in one
return
end
# 3. Only source the venv if we aren't already in one
if test -e ".venv/bin/activate.fish"
source .venv/bin/activate.fish
end
+2 -2
View File
@@ -27,8 +27,8 @@
# __config_settings_apply __fish_config_op_greeting session DEFAULT
function __config_settings_apply
set -l varname $argv[1]
set -l scope $argv[2]
set -l value $argv[3]
set -l scope $argv[2]
set -l value $argv[3]
# stderr is suppressed because setting a value in one scope while the
# other scope already holds the same variable makes interactive fish
+2 -2
View File
@@ -27,8 +27,8 @@
# __config_settings_set_value __fish_user_dots_path path '' # reset
function __config_settings_set_value
set -l varname $argv[1]
set -l type $argv[2]
set -l value $argv[3]
set -l type $argv[2]
set -l value $argv[3]
# stderr suppressed: editing a universal while a global of the same name
# shadows it makes interactive fish emit a shadow warning that would
+3 -3
View File
@@ -28,9 +28,9 @@ function __config_settings_subcats --description 'List the sub-categories for on
case __fish_config_op_aliases
printf '%s\t%s\t%s\n' \
filesystem Filesystem "ls, cat, cd, du, mkdir, rm, mv, zoxide" \
search Search "rg" \
search Search rg \
network Network "ping, ssh, yt-dlp" \
monitor Monitor "top" \
monitor Monitor top \
shell-tools Shell-tools "bash, less, help" \
dev-tools Dev-tools "claude, edit, agy"
case __fish_config_op_autoexec
@@ -52,7 +52,7 @@ function __config_settings_subcats --description 'List the sub-categories for on
window-mgmt Window-mgmt "spwin, tab, split" \
notifications Notifications "done, WakaTime hook" \
history-logs History-logs "hist, logs" \
pkg-upgrade Pkg-upgrade "upgrade"
pkg-upgrade Pkg-upgrade upgrade
case __fish_config_op_logging
printf '%s\t%s\t%s\n' \
terminal-capture Term-capture "Kitty watcher, smart_exit scrollback" \
+2 -2
View File
@@ -34,7 +34,7 @@
function __fish_user_dots_link --description 'Manage the user-dots convenience symlink'
set -l link "$__fish_config_dir/user-dots"
set -q __fish_user_dots_path
or set -l __fish_user_dots_path "$XDG_CONFIG_HOME/.user-dots/fish"
or set -l __fish_user_dots_path "$XDG_CONFIG_HOME/.user-dots/fish"
# Explicit opt-out: remove our symlink (never a real file/dir) and stop.
__fish_variable_check __fish_user_dots_symlink
@@ -49,7 +49,7 @@ function __fish_user_dots_link --description 'Manage the user-dots convenience s
test -d "$__fish_user_dots_path"; or return 0
if test -L "$link"
test (readlink "$link") != "$__fish_user_dots_path"
and ln -sfn "$__fish_user_dots_path" "$link"
and ln -sfn "$__fish_user_dots_path" "$link"
else if not test -e "$link"
ln -s "$__fish_user_dots_path" "$link"
end
+1 -1
View File
@@ -14,7 +14,7 @@
function __insert_previous_path_head
# Get the last command tokens
set -l tokens (string split -n " " -- $history[1])
# If there are tokens, take the last one and strip the 'tail'
if set -q tokens[-1]
set -l path_head (dirname -- $tokens[-1])
+4 -4
View File
@@ -14,19 +14,19 @@
function __interactive_history_sub
set -l current_line (commandline -b)
set -l last_cmd $history[1]
if string match -qr '(.+)/(.+)' -- "$current_line"
set -l parts (string split '/' -- "$current_line")
set -l old $parts[1]
set -l new $parts[2]
set -l history_index 1
if test (count $parts) -ge 3; and string match -qr '^[1-9][0-9]*$' -- "$parts[3]"
set history_index $parts[3]
end
set -l target_cmd $history[$history_index]
if test -n "$target_cmd"
set -l expanded (string replace -a -- "$old" "$new" "$target_cmd")
commandline -r "$expanded"
+5 -5
View File
@@ -16,21 +16,21 @@
function __substitute_typo
set -l cursor_pos (commandline -C)
set -l cmd (commandline)
# Check if the current line matches the ^old^new pattern
if string match -qr '\^([^^]+)\^([^^]*)' -- "$cmd"
set -l last_cmd $history[1]
set -l captured (string match -r '\^([^^]+)\^([^^]*)' -- "$cmd")
set -l old $captured[2]
set -l new $captured[3]
if test -n "$old"
set -l expanded (string replace -a -- "$old" "$new" "$last_cmd")
commandline -r "$expanded"
# No need to move cursor, it's a whole new line
end
else
# If it's just a normal caret (not part of a pattern), just insert it
end
else
# If it's just a normal caret (not part of a pattern), just insert it
commandline -i '^'
end
end
+2 -2
View File
@@ -38,8 +38,8 @@ function _agents_init_ensure_gitignore
return 1
end
set -l root $argv[1]
set -l label $argv[2]
set -l root $argv[1]
set -l label $argv[2]
set -l patterns $argv[3..]
set -l gitignore "$root/.gitignore"
+16 -8
View File
@@ -75,14 +75,14 @@ function _fish_deps_install
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
if test -n "$_major"; and test "$_major" -lt 4
set needs_install 1
set upgrade_label "Upgrade"
set upgrade_label Upgrade
end
end
if test $needs_install -eq 1
set -l cargo_crate $_fdc_cargo[$i]
set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i]
set -l cargo_crate $_fdc_cargo[$i]
set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i]
# Build list of available install methods
set -l methods
@@ -193,7 +193,9 @@ function _fish_deps_install
echo " Available methods:"
set -l m 1
for lbl in $method_labels
set_color brblack; echo -n " $m) "; set_color normal
set_color brblack
echo -n " $m) "
set_color normal
echo $lbl
set m (math $m + 1)
end
@@ -202,7 +204,9 @@ function _fish_deps_install
set chosen_method $methods[$_choice]
end
else
set_color brblack; echo " "(string lower $upgrade_label)"ing via $method_labels[1]"; set_color normal
set_color brblack
echo " "(string lower $upgrade_label)"ing via $method_labels[1]"
set_color normal
end
# Execute chosen method
@@ -329,14 +333,18 @@ function _fish_deps_install
if test $status -eq 0
set installed_any 1
set_color green; echo " $bin "(string lower $upgrade_label)"ed."; set_color normal
set_color green
echo " $bin "(string lower $upgrade_label)"ed."
set_color normal
if test "$bin" = fish
set_color yellow
echo " Fish upgraded — restart your shell to use the new version."
set_color normal
end
else
set_color red; echo " $bin "(string lower $upgrade_label)" failed."; set_color normal
set_color red
echo " $bin "(string lower $upgrade_label)" failed."
set_color normal
end
end
set i (math $i + 1)
+34 -12
View File
@@ -23,35 +23,57 @@ function _fish_deps_status
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
if test -n "$_major"; and test "$_major" -lt 4
set -l _ver (fish --version 2>&1 | string replace 'fish, ' '')
set_color yellow; echo -n " ⚠ "; set_color normal
set_color yellow
echo -n " ⚠ "
set_color normal
echo -n "$bin "
set_color brblack; echo "($_ver — upgrade to 4.0+ required)"; set_color normal
set_color brblack
echo "($_ver — upgrade to 4.0+ required)"
set_color normal
return
end
end
set_color green; echo -n " ✓ "; set_color normal
set_color green
echo -n " ✓ "
set_color normal
echo -n "$bin "
set_color brblack; echo "(Found at "(__fish_real_command $bin)")"; set_color normal
set_color brblack
echo "(Found at "(__fish_real_command $bin)")"
set_color normal
else if test "$tier" = req
set_color red; echo -n " ✗ "; set_color normal
set_color red
echo -n " ✗ "
set_color normal
echo -n "$bin "
set_color brblack; echo "(Not installed)"; set_color normal
set_color brblack
echo "(Not installed)"
set_color normal
else if test "$tier" = rec
set_color yellow; echo -n " ⚠ "; set_color normal
set_color yellow
echo -n " ⚠ "
set_color normal
echo -n "$bin "
set_color brblack; echo "(Not installed)"; set_color normal
set_color brblack
echo "(Not installed)"
set_color normal
else
# opt / term / int: absence is expected and not alarming
set_color brblack; echo -n " – "; set_color normal
set_color brblack
echo -n " – "
set_color normal
echo -n "$bin "
set_color brblack; echo "(Not installed)"; set_color normal
set_color brblack
echo "(Not installed)"
set_color normal
end
end
for tier_label in "Required Dependencies:req" "Recommended Dependencies:rec" "Optional Dependencies:opt" "Terminal Emulators:term" "Integrations:int"
set -l label (string split : $tier_label)[1]
set -l tier (string split : $tier_label)[2]
set_color cyan; echo $label; set_color normal
set -l tier (string split : $tier_label)[2]
set_color cyan
echo $label
set_color normal
set -l i 1
for bin in $_fdc_bins
if test "$_fdc_tiers[$i]" = $tier
+11 -7
View File
@@ -33,9 +33,9 @@ function _fish_deps_update
continue
end
set -l cargo_crate $_fdc_cargo[$i]
set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i]
set -l cargo_crate $_fdc_cargo[$i]
set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i]
# yay: update via paru if available, else system PM
if test "$special" = yay-build
@@ -101,10 +101,14 @@ function _fish_deps_update
echo "Updating $bin..."
set -l _arch (uname -m)
switch $_arch
case x86_64; set _arch amd64
case aarch64 arm64; set _arch arm64
case armv7l; set _arch arm
case '*'; set _arch amd64
case x86_64
set _arch amd64
case aarch64 arm64
set _arch arm64
case armv7l
set _arch arm
case '*'
set _arch amd64
end
set -l _zip "wakatime-cli-linux-$_arch.zip"
set -l _bin_src "wakatime-cli-linux-$_arch"
+1 -1
View File
@@ -46,7 +46,7 @@ function _fish_mkdir_p --description 'mkdir -p with configurable verbose output'
while not test -d $cursor
set -p to_create $cursor
set -l up (dirname $cursor)
test "$up" = "$cursor"; and break # filesystem root guard
test "$up" = "$cursor"; and break # filesystem root guard
set cursor $up
end
-1
View File
@@ -7,4 +7,3 @@ function _puffer_fish_expand_bang
commandline --insert '!'
end
end
+1 -1
View File
@@ -4,7 +4,7 @@ function _puffer_fish_expand_star
else if string match --quiet -- '!' "$(commandline --current-token)"
set -l prev_cmd $history[1]
set -l prev_args (string split ' ' $prev_cmd)
set -e prev_args[1] # remove command name
set -e prev_args[1] # remove command name
set -l arg_str (string join ' ' $prev_args)
# replace !* with all arguments
commandline --current-token ''
+3 -3
View File
@@ -28,9 +28,9 @@ function _smart_execute --description 'Execute different functions based on the
# If it ends in =, run qalc; fall back to normal execute if qalc is absent
_qalc_eval; or commandline -f execute
# case 'g *'
# # EXAMPLE FUTURE EXTENSION
# _some_git_helper
# case 'g *'
# # EXAMPLE FUTURE EXTENSION
# _some_git_helper
case '*'
# Default: execute the command line as-is
+2 -4
View File
@@ -893,8 +893,7 @@ function agents-vault --description 'track curated agent memory in a host-scoped
command cp -rn "$stash/." "$entry/" 2>/dev/null
rm -rf "$stash"
end
printf 'renamed: %s → %s (%s)\n' "$prev_slug" "$slug" (date -I) \
>>"$entry/origin"
printf 'renamed: %s → %s (%s)\n' "$prev_slug" "$slug" (date -I) >>"$entry/origin"
# Only a link is dropped here, and only so the relink below has
# somewhere to put the new one. Usually $live is exactly that: a
# symlink at the old entry, now dangling. But the migration is
@@ -1078,8 +1077,7 @@ function agents-vault --description 'track curated agent memory in a host-scoped
end
set -l reached 1
if git -C "$vault" rev-parse --abbrev-ref --symbolic-full-name '@{u}' >/dev/null 2>&1
if not $gitnet git -C "$vault" pull --rebase --autostash -q \
>/dev/null 2>/dev/null
if not $gitnet git -C "$vault" pull --rebase --autostash -q >/dev/null 2>/dev/null
# Two unrelated failures land here and reporting them as
# one sends the user hunting for a conflict that never
# existed. A rebase that genuinely started and stopped
+4 -4
View File
@@ -52,10 +52,10 @@ function agy --wraps=agy --description 'agy wrapper: auto-initializes AGENTS/ su
agents-vault --quiet
for i in (seq (count $argv))
if test "$argv[$i]" = "-r"
set argv[$i] "-c"
else if test "$argv[$i]" = "--resume"
set argv[$i] "--continue"
if test "$argv[$i]" = -r
set argv[$i] -c
else if test "$argv[$i]" = --resume
set argv[$i] --continue
else if string match -q -- "--resume=*" "$argv[$i]"
set argv[$i] (string replace -- "--resume=" "--continue=" "$argv[$i]")
end
+17 -8
View File
@@ -25,11 +25,20 @@
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
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
set -l REPO $argv[1]
if not set -q GITEA_URL; echo "\$GITEA_URL not set"; return 1; end
if not set -q GITEA_URL
echo "\$GITEA_URL not set"
return 1
end
set -l IMPORT_COUNT 0
echo (set_color blue)"📡 Checking Gitea: $REPO..."(set_color normal)
@@ -46,12 +55,12 @@ function bd-pull --description 'Pull new Gitea issues into local Beads and link
# If it doesn't have [ID] brackets, it's a "Web-Original" issue
if not string match -qr "^\[.*\]" "$title"
echo (set_color yellow)"➕ Linking Web Issue #$number: $title"(set_color normal)
# A. Create local Bead and capture the new ID
# This captures the output of bd create to find the ID it generated
set -l bd_output (bd create --title "$title")
set -l bid (echo $bd_output | string match -r "bd-[a-z0-9]+" | head -n 1)
if test -z "$bid"
# Fallback: find the latest ID in the jsonl if regex fails
set bid (tail -n 1 .beads/issues.jsonl | jq -r '.id')
@@ -61,9 +70,9 @@ function bd-pull --description 'Pull new Gitea issues into local Beads and link
# This prevents the Gitea Action from creating a duplicate
set -l new_title "[$bid] $title"
curl -s -X PATCH -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"title\":\"$new_title\"}" \
"$GITEA_URL/api/v1/repos/$REPO/issues/$number" > /dev/null
-H "Content-Type: application/json" \
-d "{\"title\":\"$new_title\"}" \
"$GITEA_URL/api/v1/repos/$REPO/issues/$number" >/dev/null
set IMPORT_COUNT (math $IMPORT_COUNT + 1)
end
+3 -3
View File
@@ -27,12 +27,12 @@ function branch --description 'Switch to or create a git branch'
echo "Not a git repo."
return 1
end
# Check if the branch already exists locally
if git show-ref --verify --quiet refs/heads/$argv[1]
git checkout $argv
else
# If it doesn't exist, create it
git checkout -b $argv
end
git checkout -b $argv
end
end
+1 -1
View File
@@ -26,5 +26,5 @@ function cheat --wraps='cheat' --description 'alias cheat=cheat -c'
else
man $argv
end
end
+3 -3
View File
@@ -23,9 +23,9 @@ function cleanup --description 'Log orphans to ~/.removed_orphans and remove the
set -l orphans (pacman -Qtdq)
if test -n "$orphans"
echo "📝 Logging orphans to ~/.removed_orphans..."
echo "--- Removed on $(date) ---" >> ~/.removed_orphans
pacman -Qi $orphans | grep -E '^(Name|Version)' >> ~/.removed_orphans
echo "--- Removed on $(date) ---" >>~/.removed_orphans
pacman -Qi $orphans | grep -E '^(Name|Version)' >>~/.removed_orphans
echo "🧹 Removing orphans..."
sudo pacman -Rns $orphans
else
+1 -1
View File
@@ -80,7 +80,7 @@ function config-update --description 'Pull latest fish config from upstream'
end
# ── compare local HEAD to upstream ───────────────────────────
set -l local_sha (git -C "$CONFIG_DIR" rev-parse HEAD 2>/dev/null)
set -l local_sha (git -C "$CONFIG_DIR" rev-parse HEAD 2>/dev/null)
set -l remote_sha (git -C "$CONFIG_DIR" rev-parse _config_update/main 2>/dev/null)
if test "$local_sha" = "$remote_sha"
+9 -9
View File
@@ -25,15 +25,15 @@ function fish_prompt
set -l last_status $status
# Catppuccin Mocha hex palette
set -l c_green '#a6e3a1'
set -l c_red '#f38ba8'
set -l c_green '#a6e3a1'
set -l c_red '#f38ba8'
set -l c_yellow '#f9e2af'
set -l c_text '#cdd6f4'
set -l c_blue '#89b4fa'
set -l c_teal '#94e2d5'
set -l c_pink '#f5c2e7'
set -l c_dim '#6c7086'
set -l c_mauve '#cba6f7'
set -l c_text '#cdd6f4'
set -l c_blue '#89b4fa'
set -l c_teal '#94e2d5'
set -l c_pink '#f5c2e7'
set -l c_dim '#6c7086'
set -l c_mauve '#cba6f7'
# Line/connector color tracks last exit status; brackets stay bold green
set -l retc $c_green
@@ -129,7 +129,7 @@ function fish_prompt
set_color normal
end
echo # newline
echo # newline
# Background jobs (one per line, dim)
for job in (jobs -c)
+3 -3
View File
@@ -8,8 +8,8 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
echo "fisher, version $fisher_version"
case "" -h --help
echo "Usage: fisher install <plugins...> Install plugins"
echo " fisher remove <plugins...> Remove installed plugins"
echo " fisher uninstall <plugins...> Remove installed plugins (alias)"
echo " fisher remove <plugins...> Remove installed plugins"
echo " fisher uninstall <plugins...> Remove installed plugins (alias)"
echo " fisher update <plugins...> Update installed plugins"
echo " fisher update Update all installed plugins"
echo " fisher list [<regex>] List installed plugins matching regex"
@@ -41,7 +41,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
end
set arg_plugins $file_plugins
else if test "$cmd" = install && ! set --query old_plugins[1]
else if test "$cmd" = install && ! set --query old_plugins[1]
set --append arg_plugins $file_plugins
end
+1 -1
View File
@@ -25,7 +25,7 @@ function gip6 --description 'Get public IPv6 address'
# Use -6 to force IPv6 and --fail to catch network errors
set -l ip (curl -6 -s --fail https://icanhazip.com 2>/dev/null)
if test $status -eq 0
echo $ip
else
+2 -2
View File
@@ -27,12 +27,12 @@ function gitup --description 'Fetch updates and show git status'
echo "Check your map! You aren't in a git repository."
return 1
end
if count $argv >/dev/null
git fetch $argv
else
git fetch
end
and git status
end
+1 -1
View File
@@ -35,7 +35,7 @@ function hist --description 'Search fish history and put it in the prompt'
if test -n "$selected"
# Strip the timestamp for the final output
set -l command (echo $selected | string replace -r '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} ' '')
echo $command | wl-copy 2>/dev/null
commandline -r $command
end
+5 -6
View File
@@ -135,11 +135,11 @@ function logs --description 'Browse terminal log files interactively with fzf'
set -l togglescript (mktemp)
set -l deletescript (mktemp)
set -l helpflag "$tmpfile.help"
printf '%s\n' $fzf_lines > $tmpfile
printf 'Terminal Logs — Key Bindings\n\n Enter View selected log in pager\n Ctrl-E Edit selected log in editor\n Ctrl-D Delete selected log\n Ctrl-C Quit\n ? Toggle this help\n\nFiltering:\n Type to fuzzy-filter by date or category\n Use -c flag to limit: scrollback, paru, yay' > $helpfile
printf '%s\n' $fzf_lines >$tmpfile
printf 'Terminal Logs — Key Bindings\n\n Enter View selected log in pager\n Ctrl-E Edit selected log in editor\n Ctrl-D Delete selected log\n Ctrl-C Quit\n ? Toggle this help\n\nFiltering:\n Type to fuzzy-filter by date or category\n Use -c flag to limit: scrollback, paru, yay' >$helpfile
# Help toggle script — avoids nested parens inside transform()
printf '#!/bin/sh\nif test -f %s; then\n rm -f %s\n printf "change-preview(command cat {1})"\nelse\n touch %s\n printf "change-preview(command cat %s)"\nfi\n' \
$helpflag $helpflag $helpflag $helpfile > $togglescript
$helpflag $helpflag $helpflag $helpfile >$togglescript
chmod +x $togglescript
# Delete confirmation script — avoids nested parens inside execute(), and ensures
# tmpfile is updated before +reload fires (execute is synchronous, execute-silent is not)
@@ -151,8 +151,7 @@ function logs --description 'Browse terminal log files interactively with fzf'
'case "$confirm" in [nN]) exit 0 ;; esac' \
"fish -c \"rm \$FILE\"" \
"grep -vF \"\$FILE\" $tmpfile > $tmpfile.new" \
"mv $tmpfile.new $tmpfile" \
> $deletescript
"mv $tmpfile.new $tmpfile" >$deletescript
chmod +x $deletescript
set -l selected (command cat $tmpfile | fzf \
@@ -196,7 +195,7 @@ function logs --description 'Browse terminal log files interactively with fzf'
# is displayed without ov's default slateblue background, preserving
# the original ANSI colors of the starship prompt.
set -l ov_cfg (mktemp --suffix .yaml)
printf 'Mode:\n scrollback:\n Style:\n SectionLine:\n Background: ""\n Foreground: ""\n' > $ov_cfg
printf 'Mode:\n scrollback:\n Style:\n SectionLine:\n Background: ""\n Foreground: ""\n' >$ov_cfg
command ov --config $ov_cfg --view-mode scrollback \
--section-delimiter '\x1b\]133;A' --section-header --section-header-num 1 $file
rm -f $ov_cfg
+64 -16
View File
@@ -187,28 +187,52 @@ function pkg --description 'Install or remove packages via the system package ma
switch $pm
case paru yay
$pm -S $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case pacman
sudo pacman -S $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case apt
sudo apt install -y $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case dnf
sudo dnf install -y $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case zypper
sudo zypper install -y $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case brew
brew install $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case pkg
sudo pkg install -y $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case yum
sudo yum install -y $to_install
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
end
end
@@ -217,28 +241,52 @@ function pkg --description 'Install or remove packages via the system package ma
switch $pm
case paru yay
$pm -Rns $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case pacman
sudo pacman -Rns $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case apt
sudo apt remove -y $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case dnf
sudo dnf remove -y $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case zypper
sudo zypper remove -y $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case brew
brew uninstall $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case pkg
sudo pkg delete -y $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
case yum
sudo yum remove -y $to_remove
or begin; functions -e __pkg_is_installed; return $status; end
or begin
functions -e __pkg_is_installed
return $status
end
end
end
end
+6 -6
View File
@@ -62,9 +62,9 @@ function rand_string --description 'Generate random, memorable strings from cura
return 0
end
set -l sep "dash"
set -l casing "lower"
set -l sep dash
set -l casing lower
# Locate the words directory relative to this function
set -l words_dir ""
if set -q __fish_config_dir
@@ -114,9 +114,9 @@ function rand_string --description 'Generate random, memorable strings from cura
set -l actual_sep $sep
switch $sep
case dash
set actual_sep "-"
set actual_sep -
case underscore
set actual_sep "_"
set actual_sep _
case dot
set actual_sep "."
case none empty
@@ -144,7 +144,7 @@ function rand_string --description 'Generate random, memorable strings from cura
echo "rand_string: unknown category or file missing for '$arg'" >&2
return 1
end
# Fetch random line (shuf is fastest, random choice is portable fallback)
if command -q shuf
set part (command shuf -n 1 "$db")
+2 -2
View File
@@ -17,6 +17,6 @@
# EXAMPLE
# rawfish
function rawfish --wraps='env NO_TMUX=1 fish' --description 'alias rawfish=env NO_TMUX=1 fish'
env NO_TMUX=1 fish $argv
env NO_TMUX=1 fish $argv
end
+4 -4
View File
@@ -90,12 +90,12 @@ function repo-open --description 'Open the origin remote of the current repo in
set had_scheme 1
end
set -l u (string replace -r '^[a-z0-9]+://' '' -- $remote) # strip scheme
set u (string replace -r '^[^@/]+@' '' -- $u) # strip user@
set u (string replace -r '\.git$' '' -- $u) # strip .git
set u (string replace -r '^[^@/]+@' '' -- $u) # strip user@
set u (string replace -r '\.git$' '' -- $u) # strip .git
if test $had_scheme -eq 0
set u (string replace ':' '/' -- $u) # scp: first colon → path sep
set u (string replace ':' '/' -- $u) # scp: first colon → path sep
else
set u (string replace -r ':[0-9]+/' '/' -- $u) # url: drop :port
set u (string replace -r ':[0-9]+/' '/' -- $u) # url: drop :port
end
set -l parts (string split -m1 '/' -- $u)
+43 -43
View File
@@ -24,53 +24,53 @@
# 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
__fish_help_header (status current-function) $argv; and return 0
if not type -q sbctl
echo "Error: 'sbctl' is not installed."
return 1
end
if not type -q sbctl
echo "Error: 'sbctl' is not installed."
return 1
end
# ANSI color codes (Fish uses set_color for easier management)
set RED (set_color red)
set GREEN (set_color green)
set NC (set_color normal)
# ANSI color codes (Fish uses set_color for easier management)
set RED (set_color red)
set GREEN (set_color green)
set NC (set_color normal)
# Flags
set brief_mode false
if test "$argv[1]" = "--brief"
set brief_mode true
end
# Flags
set brief_mode false
if test "$argv[1]" = --brief
set brief_mode true
end
# Counters
set pass_count 0
set fail_count 0
# Counters
set pass_count 0
set fail_count 0
# Run and process sbctl output
# Fish doesn't use 'done < <()'; we pipe directly into the while loop
sudo sbctl verify 2>&1 | grep -v -i 'invalid pe header' | while read -l line
if string match -q "*✓*" -- "$line"
set pass_count (math $pass_count + 1)
if not $brief_mode
echo -e "$GREEN$line$NC"
end
else if string match -q "*✗*" -- "$line"
set fail_count (math $fail_count + 1)
if not $brief_mode
echo -e "$RED$line$NC"
end
else
if not $brief_mode
echo "$line"
end
end
end
# Run and process sbctl output
# Fish doesn't use 'done < <()'; we pipe directly into the while loop
sudo sbctl verify 2>&1 | grep -v -i 'invalid pe header' | while read -l line
if string match -q "*✓*" -- "$line"
set pass_count (math $pass_count + 1)
if not $brief_mode
echo -e "$GREEN$line$NC"
end
else if string match -q "*✗*" -- "$line"
set fail_count (math $fail_count + 1)
if not $brief_mode
echo -e "$RED$line$NC"
end
else
if not $brief_mode
echo "$line"
end
end
end
# Summary
echo
if test $fail_count -eq 0
echo -e "$GREEN✅ All images are signed ($pass_count verified)$NC"
else
echo -e "$RED❌ Some images are not signed ($fail_count failed, $pass_count passed)$NC"
end
# Summary
echo
if test $fail_count -eq 0
echo -e "$GREEN✅ All images are signed ($pass_count verified)$NC"
else
echo -e "$RED❌ Some images are not signed ($fail_count failed, $pass_count passed)$NC"
end
end
+1 -1
View File
@@ -23,7 +23,7 @@
# spark 1 1 2 5 14 42
# seq 64 | sort --random-sort | spark
# echo "3 7 2 9 1" | spark
function spark --description 'Sparklines'
function spark --description Sparklines
argparse --ignore-unknown --name=spark v/version h/help m/min= M/max= -- $argv || return
if set --query _flag_version[1]
+2 -2
View File
@@ -23,7 +23,7 @@ function sudo-toggle --description 'Toggle sudo password requirement on/off'
# 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)
if test -n "$file_size"; and test "$file_size" -gt 0
# 1. Toggle is currently OFF (Bypass is active). We want to turn security back ON.
# We use 'sudo -k' to clear the execution cache so it locks down instantly.
@@ -32,7 +32,7 @@ function sudo-toggle --description 'Toggle sudo password requirement on/off'
else
# 2. Toggle is currently ON (Security active). We want to BYPASS it.
# We write a high-priority user-specific NOPASSWD rule.
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/nofail-toggle > /dev/null
echo "$USER ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/nofail-toggle >/dev/null
echo "🔓 Sudo security: DISABLED (Bypass active)"
end
end
+2 -2
View File
@@ -22,9 +22,9 @@ function swapstat --description 'View colorized zRAM and swappiness status'
set -l swappiness (sysctl -n vm.swappiness)
set -l zdata (zramctl --bytes --noheadings --output DATA,TOTAL /dev/zram0 2>/dev/null)
echo (set_color --bold blue)"── Memory & zRAM Report ──"(set_color normal)
# Kernel & Compression Stats
if test -n "$zdata"
set -l raw (echo $zdata | awk '{print $1}')
+1 -1
View File
@@ -22,5 +22,5 @@ function view --wraps='nvim -R' --description 'alias view=nvim -R'
else
less $argv
end
end
+1 -1
View File
@@ -70,4 +70,4 @@ end
# ls | cb
function cb --wraps='y' --description 'Alias cb=y'
y $argv
end
end
+1 -1
View File
@@ -62,7 +62,7 @@ function yt-dlp --description 'yt-dlp with embedding + SponsorBlock defaults'
# --sponsorblock-remove all
# Skip if the user set their own remove (bare or --opt=value form), or
# disabled SponsorBlock entirely with --no-sponsorblock.
if not string match -q -- '--sponsorblock-remove' $argv
if not string match -q -- --sponsorblock-remove $argv
and not string match -q -- '--sponsorblock-remove=*' $argv
and not contains -- --no-sponsorblock $argv
set -a extra --sponsorblock-remove all