feat(help): render --help from function headers; stop 8 functions executing on --help #132

Merged
rootiest merged 10 commits from feat/header-driven-help into main 2026-09-08 05:39:24 +00:00
7 changed files with 14 additions and 0 deletions
Showing only changes of commit 3399149cba - Show all commits
+2
View File
@@ -14,6 +14,8 @@
# EXAMPLE # EXAMPLE
# gip # gip
function gip --description 'Show all public IP addresses' function gip --description 'Show all public IP addresses'
__fish_help_header (status current-function) $argv; and return 0
echo -n "IPv4: " echo -n "IPv4: "
curl -4 -s --max-time 2 https://icanhazip.com || echo "Not detected" curl -4 -s --max-time 2 https://icanhazip.com || echo "Not detected"
echo -n "IPv6: " echo -n "IPv6: "
+2
View File
@@ -13,5 +13,7 @@
# EXAMPLE # EXAMPLE
# gip4 # gip4
function gip4 --wraps='curl' --description 'Get public IPv4 address' 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 curl -4 -s https://icanhazip.com
end end
+2
View File
@@ -21,6 +21,8 @@
# EXAMPLE # EXAMPLE
# gip6 # gip6
function gip6 --description 'Get public IPv6 address' 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 # Use -6 to force IPv6 and --fail to catch network errors
set -l ip (curl -6 -s --fail https://icanhazip.com 2>/dev/null) set -l ip (curl -6 -s --fail https://icanhazip.com 2>/dev/null)
+2
View File
@@ -14,5 +14,7 @@
# EXAMPLE # EXAMPLE
# ports # ports
function ports --wraps='sudo' --description 'Show active network listeners' 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 sudo lsof -iTCP -sTCP:LISTEN -P -n
end end
+2
View File
@@ -24,6 +24,8 @@
# sbver # sbver
# sbver --brief # sbver --brief
function sbver --description 'Verifies Secure Boot status of EFI binaries using sbctl' 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 if not type -q sbctl
echo "Error: 'sbctl' is not installed." echo "Error: 'sbctl' is not installed."
return 1 return 1
+2
View File
@@ -14,6 +14,8 @@
# EXAMPLE # EXAMPLE
# steam-dl # steam-dl
function steam-dl --description 'Run Steam while inhibiting system sleep' 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..." echo "Inhibiting sleep while Steam downloads..."
systemd-inhibit --why="Active Download" --who="User" --what=idle:sleep steam systemd-inhibit --why="Active Download" --who="User" --what=idle:sleep steam
end end
+2
View File
@@ -15,6 +15,8 @@
# EXAMPLE # EXAMPLE
# swapstat # swapstat
function swapstat --description 'View colorized zRAM and swappiness status' 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 swappiness (sysctl -n vm.swappiness)
set -l zdata (zramctl --bytes --noheadings --output DATA,TOTAL /dev/zram0 2>/dev/null) set -l zdata (zramctl --bytes --noheadings --output DATA,TOTAL /dev/zram0 2>/dev/null)