20 KiB
20 KiB
layout, permalink
| layout | permalink |
|---|---|
| layouts/base.njk | / |
./task
Run any project.
The task file is a simple bash script and standardized interface for all software projects.
It is to be understood as a software development pattern to standardize the installation, configuration and execution of different software frameworks.
Specification
The specification is a short guide to set up a task file for a Python project.
- Create a file
taskin your project.
touch task
- Ensure it is executable.
chmod +x task
- First add the bash shebang.
#!/bin/bash
- Then append the abort on error setting.
set -e
- Load environment variables from the
.envfile.
if [[ -a ".env" ]]; then
source .env
fi
- Add a help function.
function help-table() {
CMD_WIDTH=10
OPT_WIDTH=6
DESC_WIDTH=40
COLUMN="| %-${CMD_WIDTH}s | %-${OPT_WIDTH}s | %-${DESC_WIDTH}s |\n"
printf "$COLUMN" "Command" "Option" "Description"
echo "|$(printf '%*s' $((CMD_WIDTH + 2)) '' | tr ' ' '-')|$(printf '%*s' $((OPT_WIDTH + 2)) '' | tr ' ' '-')|$(printf '%*s' $((DESC_WIDTH + 2)) '' | tr ' ' '-')|"
printf "$COLUMN" "all" "" "Run all tasks."
printf "$COLUMN" "help" "[grep]" "Show help for commands."
<