Initial commit
This commit is contained in:
commit
d6e2fe6f98
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
# -*- sh-mode -*-
|
||||
|
||||
DEFAULT_MANDIR=/bread/man
|
||||
DEFAULT_MANSECTION=bread
|
||||
|
||||
usage() {
|
||||
prog="${BASH_SOURCE[0]}"
|
||||
cat <<ENDUSAGE
|
||||
$prog: easily write recipes and bread-related stuff
|
||||
OPTIONS
|
||||
-h show this help
|
||||
-d DIR specify a manual directory. Default: "$DEFAULT_MANDIR"
|
||||
-s SECTION specify a manual section. Default: "$DEFAULT_MANSECTION"
|
||||
ENDUSAGE
|
||||
}
|
||||
|
||||
template() { # template TITLE HEADER FOOTER
|
||||
name="$1"
|
||||
header="$2"
|
||||
footer="$3"
|
||||
upname="$(printf %s "$name" | tr a-z A-Z)"
|
||||
cat <<ENDTEMPLATE
|
||||
% $upname($MANSECTION) $header | $footer
|
||||
% $USER
|
||||
|
||||
# NAME
|
||||
|
||||
**$name** -- makes <!--YIELD-->
|
||||
|
||||
time
|
||||
~ <!--TIME-->
|
||||
|
||||
# DESCRIPTION
|
||||
<!-- introductory notes, history, or tips go here -->
|
||||
<!-- DON'T make it very long! -->
|
||||
<!-- You can add extra notes in the NOTES section. -->
|
||||
|
||||
|
||||
# INGREDIENTS
|
||||
<!-- ingredients should be listed as bullet points in this format: -->
|
||||
<!-- - <Quantity> <Measurement> <Ingredient>, <Preperation> -->
|
||||
<!-- Where Quantity is a number, Measurement is something like cups or grams, -->
|
||||
<!-- Ingredient is the ... ingredient, and Preparation is -->
|
||||
<!-- what you need to do to prepare the ingredient, like dicing, etc. -->
|
||||
<!-- Preparation is optional, and Measurement should only be used when you're measuring. -->
|
||||
|
||||
|
||||
# METHOD
|
||||
<!-- List out the method here, in full paragraphs. -->
|
||||
<!-- Look at other recipes for style. -->
|
||||
|
||||
|
||||
<!-- OPTIONAL: # NOTES -->
|
||||
<!-- If you'd
|
||||
ENDTEMPLATE
|
||||
}
|
||||
|
||||
main() {
|
||||
while getopts hd:s: opt; do
|
||||
case "$opt" in
|
||||
h) usage ;;
|
||||
d) MANDIR="$OPTARG" ;;
|
||||
s) MANSECTION="$OPTARG" ;;
|
||||
*)
|
||||
usage
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
: "${MANDIR:=$DEFAULT_MANDIR}"
|
||||
: "${MANSECTION:=$DEFAULT_MANSECTION}"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
Loading…
Reference in New Issue