Update: man() bash function

This commit is contained in:
Akemi Izuko 2023-12-23 20:14:09 -07:00
parent 61fc56a8ea
commit f3121d12e1
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC

View file

@ -57,8 +57,21 @@ sww() {
man() {
local command=$(IFS=-, ; echo "$*")
if [[ "$command" =~ \. ]]; then
~/.configs_pointer/bin/man_py.sh "$command"
# When section is specified,override
if [[ "$1" =~ ^[1-7]$ ]]; then
local -ri section="$1"
shift
command=$(IFS=-, ; echo "$*")
/usr/bin/man "$section" "$command"
return $?
fi
local manpy=~/.configs_pointer/bin/man_py.sh
if [[ "$command" =~ \. ]] && "$manpy" "$command" &>/dev/null; then
"$manpy" "$command"
elif /usr/bin/man "$command" >/dev/null 2>&1; then
/usr/bin/man "$command"
elif command -v "$command" &>/dev/null; then