task
fserb.com·4d
💻Terminal Tools
Preview
Report Post

There are a few common things I end up doing in all my projects, independent of the programming language I use. One of them is a text file with notes, TODOs, and design ideas. The other is a task file.

A task file is shell script with a collection of commands that I use to build, test, sync and do whatever else is needed for the project. Think of it as a mix of an annotated bash history of the project and a Makefile.

Skeleton

A task file is in the root of the project, and this is the basic skeleton of one:

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# add functions here...

function help {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | grep -v "^_" | cat -n
}

"${@:-help}"

Let’s go through the relevant lines.

set -euo pipefail

sets 3 op…

Similar Posts

Loading similar posts...