2012-04-11 19:05:43 -07:00
|
|
|
function fish_update_completions --description "Update man-page based completions"
|
2025-10-26 21:36:03 +01:00
|
|
|
set -l detach false
|
|
|
|
|
if test "$fish_update_completions_detach" = true
|
|
|
|
|
set detach true
|
|
|
|
|
end
|
2025-02-19 16:52:55 +01:00
|
|
|
set -l python (__fish_anypython)
|
|
|
|
|
or begin
|
2022-04-03 20:57:55 -07:00
|
|
|
printf "%s\n" (_ "python executable not found") >&2
|
2017-10-12 15:00:50 +02:00
|
|
|
return 1
|
2017-04-20 13:35:20 +02:00
|
|
|
end
|
2025-02-19 16:52:55 +01:00
|
|
|
|
2025-10-26 21:36:03 +01:00
|
|
|
set -l update_argv \
|
|
|
|
|
$python \
|
2025-10-26 21:43:25 +01:00
|
|
|
# Don't write .pyc files.
|
|
|
|
|
-B \
|
2025-10-26 21:36:03 +01:00
|
|
|
- \
|
2025-10-26 21:43:25 +01:00
|
|
|
# Use the manpath
|
|
|
|
|
--manpath \
|
|
|
|
|
# Clean up old completions
|
|
|
|
|
--cleanup-in $__fish_user_data_dir/generated_completions \
|
2025-10-26 21:36:03 +01:00
|
|
|
--cleanup-in $__fish_cache_dir/generated_completions
|
2025-10-26 21:43:25 +01:00
|
|
|
|
|
|
|
|
__fish_data_with_file tools/create_manpage_completions.py cat |
|
2025-10-26 21:36:03 +01:00
|
|
|
if $detach
|
|
|
|
|
# Run python directly in the background and swallow all output
|
|
|
|
|
# Orphan the job so that it continues to run in case of an early exit (#6269)
|
|
|
|
|
# Note that some distros split the manpage completion script out (#7183).
|
|
|
|
|
# In that case, we silence Python's failure.
|
|
|
|
|
/bin/sh -c '
|
|
|
|
|
c=$(cat)
|
|
|
|
|
( printf %s "$c" | "$@" ) >/dev/null 2>&1 &
|
|
|
|
|
' -- $update_argv $argv
|
|
|
|
|
else
|
|
|
|
|
# Display progress
|
|
|
|
|
$update_argv --progress $argv
|
|
|
|
|
end
|
2012-04-11 19:05:43 -07:00
|
|
|
end
|