From 3736589a7c7aaf70e574f5f2dbcea46e08cd1819 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sun, 22 Jan 2023 11:49:58 -0700 Subject: [PATCH] Update: man() bash function --- bash/.bash_functions | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bash/.bash_functions b/bash/.bash_functions index aafb209..ec82726 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -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