1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-22 15:21:30 +01:00

zsh: functions: add mangrep

This commit is contained in:
bretello 2023-01-23 20:21:57 +01:00
parent 3b6cf2b92f
commit a8c89d32c9
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -266,3 +266,21 @@ make_backup() {
function find_by_mtime() {
find $@ -printf "%T+ %p\n" | sort
}
function mangrep() {
set -x
if [[ -z "$@" ]]; then
echo "Usage: $0 <pattern> <command>"
echo "Opens man page for <command> at the first match for <pattern>"
return
fi
pattern=$1
cmd=$2
if [[ -z "$cmd" ]]; then
man "$cmd"
return
fi
MANPAGER="less -p \"$pattern\"" man "$cmd"
}