config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 86a6086195e28fd708092ab7221f439239d75af3
parent 33ef31416cbf04f466801d1aa02493aa494d8ac0
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 22 Nov 2020 17:27:37 -0800

Add `sman' script to read self-contained script documentation

This file format only works in scripting languages which use hash
(`#') as a comment character or allow multi-line comments.

Diffstat:
Amodules/scripts/.local/bin/sman | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/modules/scripts/.local/bin/sman b/modules/scripts/.local/bin/sman @@ -0,0 +1,20 @@ +#!/usr/local/bin/rc -e +#! ssman -- simple script manual system +#! +#! sman prints text following `#![<space>]' verbatim, <space> includes +#! newline and EOF. If multiple scripts are given each is seperated by +#! a blank line, three dashes, then another blank line. +#! +#! Only hashes (`#') are supported so the scripting language must use +#! them as comments or have multiline comments. + +# To increase performance perhaps using awk would be better since, +# after a manual block is printed, we can stop processing. +fn sman { egrep '^#!([[:space:]]|$)' $* | cut -c 4- } + +for (i in `{ jot $#* }) { + sman `{ which $*($i) } + if (test $i -gt 0 -a $i -lt $#*) + printf '\n---\n\n'; + man = 1; +}