Janik von Rotz 6aff8877bd docs(script): update instruction format in update-with-llm script
- Add explicit marker format `<<<...>>>` for file path definition
- Clarify output instructions to ensure correct file formatting
- Emphasize exclusion of additional text or code formatting characters
2025-10-31 10:59:52 +01:00
2025-04-11 08:25:06 +02:00
2025-04-11 08:25:06 +02:00
2025-04-08 15:21:25 +02:00

layout, permalink
layout permalink
layouts/base.njk /

./task

Run any project.

Vercel


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 task in your project.
touch task
  • Ensure it is executable.
chmod +x task
  • First add the bash shebang.
#!/usr/bin/env bash
  • Then append the abort on error setting.
set -e
  • Load environment variables from the .env file.
if [[ -a ".env" ]]; then
    source .env
fi
  • Add a help function.
help-table() {
    local cmd_width=10
    local opt_width=6
    local desc_width=40
    local 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" "help" "[grep]" "Show help for commands."
    printf "$column" "install" "" "Setup the local environment."
    printf "$column" "lint" "" "Run pre-commit and update index.html."
    printf "$column" "version" "" "Show version of required tools."
}

help() {
    echo
    if [[ -n "$1" ]]; then
        help-table | grep -i "$1" | column -t -s'|'
    else
        echo "task <command> [options]"
        echo
        echo "commands:"
        echo
        help-table
    fi
    echo
}
  • Setup the command functions.
version() {
    uv --version
}

install() {
    echo "Setup venv and install python dependencies"
    uv venv env
    source env/bin/activate
    uv pip install pre-commit
}

lint() {
    source env/bin/activate

    echo "Run pre-commit"
    pre-commit run --all-file
}
  • Finish the task file with command switch cases.
if declare -f "$1" > /dev/null; then
    "$1" "${@:2}"
else
    case "$1" in
        all)
            install
            lint
            ;;
        *)
            echo "Unknown command: $1"
            help
            exit 1
            ;;
    esac
fi

These are the main parts of every task file script.

Examples

Checkout these implementations of the task file standard:

This website is built with a task file. Here is the source: janikvonrotz/taskfile.build

S
Description
No description provided
Readme AGPL-3.0
1.3 MiB
0 Stars 1 Watchers 0 Forks
Languages
Shell 99.5%
Dockerfile 0.5%