fork/fish-shell

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

Johannes AltmanningerMerge changes to config paths6d0cd3d9b

master
1.3 KiB38 linesraw
1function fish_update_completions --description "Update man-page based completions"
2    set -l detach false
3    if test "$fish_update_completions_detach" = true
4        set detach true
5    end
6    set -l python (__fish_anypython)
7    or begin
8        printf "%s\n" (_ "python executable not found") >&2
9        return 1
10    end
11
12    set -l update_argv \
13        $python \
14        # Don't write .pyc files.
15        -B \
16        - \
17        # Use the manpath
18        --manpath \
19        --directory=$__fish_cache_dir/generated_completions \
20        # Clean up old completions
21        --cleanup-in $__fish_user_data_dir/generated_completions
22
23    status get-file tools/create_manpage_completions.py |
24        if $detach
25            # Run python directly in the background and swallow all output
26            # Orphan the job so that it continues to run in case of an early exit (#6269)
27            # Note that some distros split the manpage completion script out (#7183).
28            # In that case, we silence Python's failure.
29            set -l sh (__fish_posix_shell)
30            $sh -c '
31                c=$(cat)
32                ( printf %s "$c" | "$@" ) >/dev/null 2>&1 &
33            ' -- $update_argv $argv
34        else
35            # Display progress
36            $update_argv --progress $argv
37        end
38end