Templates¶
Source: src/function-template.sh, src/script-template
Copy-paste starting points for new bash functions and scripts. Take only what you need.
full-on-template¶
A complete function template demonstrating every common pattern:
getopts-based option parsing, a heredoc help string, variable initialization
before and after getopts, and a nested helper function.
. just-bashit/src/function-template.sh
full-on-template -h # show usage
full-on-template -p myvalue arg1 arg2
Use this when your function needs multiple options, some with arguments.
minimalist-template¶
A stripped-down function template for simple functions that don't need the full getopts machinery.
Use this as a starting point and add complexity only as needed.
script-template¶
An executable script template (not a library) demonstrating:
- Bash strict mode:
set -euo pipefail IFSconfigurationEXITtrap for cleanupgetopts-based option parsing
The template is intentionally self-contained — it does not source any just-bashit libraries, so it works as a standalone starting point.