feat(help): header-driven --help for system-info functions
gip, gip4, gip6, ports, swapstat, sbver and steam-dl. All ignored $argv, so --help previously ran the query or the launcher. sbver keeps its own --brief flag: only argv[1] is inspected and --brief is not a help flag, so the body still runs for it.
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
# 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: "
|
||||
|
||||
@@ -13,5 +13,7 @@
|
||||
# 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)
|
||||
|
||||
|
||||
@@ -14,5 +14,7 @@
|
||||
# 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
# 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
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# 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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user