feat(help): header-driven --help for listing presets

lD, lsr, lss, lstree, lt, ltr, lx and ld. None shadows a real binary, so
there is no disabled-fallback contract to honour, and `eza --help`
documented eza rather than the preset that is these functions' entire
content. First-arg-only interception leaves `lt -la --help` passing
through to eza untouched.
This commit is contained in:
2026-09-07 20:05:15 -04:00
parent 037588ecf6
commit 71574b5030
8 changed files with 16 additions and 0 deletions
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lD ~/projects # lD ~/projects
function lD --description 'List directories only' function lD --description 'List directories only'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --only-dirs --long --icons --color=auto --hyperlink $argv eza --only-dirs --long --icons --color=auto --hyperlink $argv
else if which lsd >/dev/null 2>&1 else if which lsd >/dev/null 2>&1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# ld # ld
function ld --description 'Run lazydocker on the current Docker context' 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 if not type -q docker
echo "ld: docker is not installed" >&2 echo "ld: docker is not installed" >&2
return 1 return 1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lsr ~/projects # lsr ~/projects
function lsr --description 'Reversed time-sorted listing' function lsr --description 'Reversed time-sorted listing'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --oneline --sort=modified --reverse --icons --color=auto --hyperlink $argv eza --oneline --sort=modified --reverse --icons --color=auto --hyperlink $argv
else if which lsd >/dev/null 2>&1 else if which lsd >/dev/null 2>&1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lss ~/downloads # lss ~/downloads
function lss --description 'Size-sorted listing' function lss --description 'Size-sorted listing'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 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 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 else if which lsd >/dev/null 2>&1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lstree ~/projects/myapp # lstree ~/projects/myapp
function lstree --description 'Full recursive tree listing' function lstree --description 'Full recursive tree listing'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --tree --icons --color=auto --hyperlink=auto $argv eza --tree --icons --color=auto --hyperlink=auto $argv
else if which lsd >/dev/null 2>&1 else if which lsd >/dev/null 2>&1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lt ~/projects # lt ~/projects
function lt --description 'Tree listing, depth 2' function lt --description 'Tree listing, depth 2'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --tree --level=2 --icons --color=auto --hyperlink $argv eza --tree --level=2 --icons --color=auto --hyperlink $argv
else if which lsd >/dev/null 2>&1 else if which lsd >/dev/null 2>&1
+2
View File
@@ -18,6 +18,8 @@
# EXAMPLE # EXAMPLE
# ltr ~/projects # ltr ~/projects
function ltr --description 'Reversed time-sorted listing' function ltr --description 'Reversed time-sorted listing'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --long --all --sort=modified --icons --hyperlink --color=auto --color-scale=age --color-scale-mode=gradient $argv 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 else if which lsd >/dev/null 2>&1
+2
View File
@@ -17,6 +17,8 @@
# EXAMPLE # EXAMPLE
# lx ~/projects # lx ~/projects
function lx --description 'Extension-sorted listing' function lx --description 'Extension-sorted listing'
__fish_help_header (status current-function) $argv; and return 0
if which eza >/dev/null 2>&1 if which eza >/dev/null 2>&1
eza --long --all --sort=extension --icons --color=auto --hyperlink $argv eza --long --all --sort=extension --icons --color=auto --hyperlink $argv
else if which lsd >/dev/null 2>&1 else if which lsd >/dev/null 2>&1