#!/usr/bin/env zsh ##? fnhelp - use '##?' comments in function files as help docs. ##? ##? usage: 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-