aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_print_help.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-06-10 14:13:15 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-06-10 14:13:15 +0200
commit222a07e907c239f7dab541512b109730a07828dc (patch)
treed492cd469bff2d285fd574200cc18d3d6bb78193 /share/functions/__fish_print_help.fish
parent9d2092bf9fa65450bb8a021c4ecd42af1b7bf11b (diff)
Allow compressed man pages in `help`
It seems Fedora compresses our whopping 340k of man pages. Fixes #3130. Inspired by @TieDyedDevil's work there.
Diffstat (limited to 'share/functions/__fish_print_help.fish')
-rw-r--r--share/functions/__fish_print_help.fish8
1 files changed, 6 insertions, 2 deletions
diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish
index 3d5ac0b6..265f9615 100644
--- a/share/functions/__fish_print_help.fish
+++ b/share/functions/__fish_print_help.fish
@@ -11,7 +11,7 @@ function __fish_print_help --description "Print help message for the specified f
end
# Do nothing if the file does not exist
- if not test -e "$__fish_datadir/man/man1/$item.1"
+ if not test -e "$__fish_datadir/man/man1/$item.1" -o -e "$__fish_datadir/man/man1/$item.1.gz"
return
end
@@ -39,7 +39,11 @@ function __fish_print_help --description "Print help message for the specified f
set cols (math $cols - 4) # leave a bit of space on the right
set rLL -rLL=$cols[1]n
end
- set help (nroff -man -c -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null)
+ if test -e "$__fish_datadir/man/man1/$item.1"
+ set help (nroff -man -c -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null)
+ else if test -e "$__fish_datadir/man/man1/$item.1.gz"
+ set help (gunzip -c "$__fish_datadir/man/man1/$item.1.gz" ^/dev/null | nroff -man -c -t $rLL ^/dev/null)
+ end
# The original implementation trimmed off the top 5 lines and bottom 3 lines
# from the nroff output. Perhaps that's reliable, but the magic numbers make