diff --git a/home/private_dot_config/zsh/functions/fnhelp b/home/private_dot_config/zsh/functions/fnhelp index 5a2c7d6..e3958a1 100644 --- a/home/private_dot_config/zsh/functions/fnhelp +++ b/home/private_dot_config/zsh/functions/fnhelp @@ -1,13 +1,18 @@ +#!/usr/bin/env zsh ##? fnhelp - use '##?' comments in function files as help docs. ##? ##? usage: fnhelp -# function fnhelp { local ZFUNCDIR="${ZFUNCDIR:-${ZDOTDIR:-~/.config/zsh}/functions}" + +if [[ $# -eq 0 ]]; then + echo >&2 "no function specified" + fnhelp fnhelp + return 1 +fi + if [[ ! -f "$ZFUNCDIR/$1" ]]; then echo >&2 "fnhelp: function not found '$1'." && return 1 fi -command grep "^##?" "$ZFUNCDIR/$1" | cut -c 5- -# } -# vim: ft=zsh sw=2 ts=2 et +command grep "^##?" "$ZFUNCDIR/$1" | cut -c 5-