This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/help.sh

17 lines
355 B
Bash
Raw Normal View History

2023-12-07 01:44:42 +03:00
# Get help about bash function.
function help() {
local fun="${1}"
if [[ $(find_functions | grep "${fun}") = "" ]]; then
echo "Function not found."
return 1
fi
sed -e '$s/$/\n/' -s "${DOTFILES_PATH}"/* | sed -n -e "/function ${fun}()/q;p" | tac | sed -n -e "/^$/q;p" | tac | sed -e "s/^# \+//"
}
# Short for help.
function h() {
help "${@}"
}