mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-12 09:10:45 +01:00
Batman unalias
This commit is contained in:
parent
aef5a424b4
commit
ac4f8710ba
@ -93,12 +93,20 @@ if [[ "${#MAN_ARGS[@]}" -eq 0 ]] && [[ -z "$BATMAN_LEVEL" ]] && command -v "$EXE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Some entries from `man -k .` may include "synonyms" of a man page's title.
|
||||
# For example, the manual for kubectl-edit will appear as:
|
||||
#
|
||||
# kubectl-edit(1), kubectl edit(1) - Edit a resource on the server
|
||||
#
|
||||
# `man` only needs one name/title, so we're taking the first one here.
|
||||
selected_page_unaliased="$(echo "$selected_page" | cut -d, -f1)"
|
||||
|
||||
# Convert the page(section) format to something that can be fed to the man command.
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ ^(.*)\(([0-9a-zA-Z ]+)\) ]]; then
|
||||
MAN_ARGS+=("${BASH_REMATCH[2]}" "$(echo ${BASH_REMATCH[1]} | xargs)")
|
||||
fi
|
||||
done <<< "$selected_page"
|
||||
done <<< "$selected_page_unaliased"
|
||||
fi
|
||||
|
||||
# Run man.
|
||||
|
Loading…
Reference in New Issue
Block a user