From f5b1063a8bf688a2d08125e044603d7e34cafbd1 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 27 May 2022 08:19:40 +0200 Subject: [PATCH] completions/man: See if it exists before calling Fixes #8977 --- share/completions/man.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/completions/man.fish b/share/completions/man.fish index 993a5f0c7..f48806528 100644 --- a/share/completions/man.fish +++ b/share/completions/man.fish @@ -36,6 +36,10 @@ complete -c man -s w -l path -d "Only print locations" complete -c man -s W -d "Only print locations" complete -c man -n 'string match -q -- "*/*" (commandline -t | string collect)' --force-files -if echo | MANPAGER=cat command man -l - &>/dev/null - complete -c man -s l -l local-file -d "Local file" -r +if command -q man + # We have a conditionally-defined man function, + # so we need to check for existence here. + if echo | MANPAGER=cat command man -l - &>/dev/null + complete -c man -s l -l local-file -d "Local file" -r + end end