fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes Altmanninger__fish_print_help: proper error message when 'man' is missing0b414b966

master
1014 B27 linesraw
1# localization: skip(private)
2function __fish_print_help --description "Print help for the specified fish function or builtin"
3    if not type -q man
4        fish_command_not_found man
5        return 1
6    end
7
8    set -l item (__fish_canonicalize_builtin $argv[1])
9
10    function __fish_print_help_man -V item -a man1
11        if not path is $man1
12            # Trigger the "documentation not be installed" message. Currently
13            # only when called from core.
14            return 2
15        end
16        set -l args -l (path filter -- $man1/$item.1 $man1/$item.1.gz)[1]
17        # Work around macOS/FreeBSD man not supporting -l yet (only mandoc really needs it).
18        if not __fish_without_manpager command man -l $args[2] &>/dev/null
19            set -e args[1]
20        end
21        command man $args
22    end
23    __fish_data_with_directory man/man1 \
24        "$(string escape --style=regex $item.1)(?:\.gz)?" \
25        __fish_print_help_man
26    __fish_with_status functions --erase __fish_print_help_man
27end