Skip to content

Commit

Permalink
man: Prioritize MANPATH, simplify, add fallback e.g. for busybox, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Apr 15, 2016
1 parent 01eda2e commit c9f54e7
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions completions/man
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,10 @@ _man()
return 0
fi

local manpath
if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then
manpath=$( manpath 2>/dev/null || command man -w )
else
manpath=$MANPATH
fi

if [[ -z $manpath ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
fi
local manpath="$MANPATH"
[[ -z $manpath ]] && \
manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null )
[[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man"

# determine manual section to search
local sect
Expand Down

0 comments on commit c9f54e7

Please sign in to comment.