# Library
The repository of this website provides a library of reusable functions. Clone the repository into your home folder and ensure it is updated regularly.
clone-taskfile(){
if [[ ! -d "$HOME/taskfile.build" ]]; then
echo -e '\033[38;5;214mGit\033[0m: Clone taskfile repo'
git clone https://git.taskfile.build "$HOME/taskfile.build"
else
echo -e '\033[38;5;214mGit\033[0m: Pull taskfile repo'
git -C "$HOME/taskfile.build" pull
fi
}
In your task file import all commands from the taskfile library.
if [[ -d "$HOME/taskfile.build/bin" ]]; then
for file in "$HOME/taskfile.build/bin/"*; do
if [[ -f "$file" ]]; then
source "$file"
fi
done
fi
These commands create folder in the directory of the task file and the home directory. Here is an overview of these folders:
$PWD/tmp: Temporary directory for the task commands.$PWD/.prompt: LLM prompts stored as markdown files.$HOME/.config/taskfile.build: Default path for storing dotenv files.$HOME/.docker/$CONTAINER_REGISTRY: Default path for storing container registry credentials.
# Task
Configure the task enviroment.
OPEN_BROWSER=False # Default: True
TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.build"
# clone-taskfile
rows+=("clone-taskfile||Clone the taskfile.build repo.")
# init-project
rows+=("init-project||Setup a taskfile project in the current directory.")
# init-config-dir
rows+=("init-dotenv-dir||Setup task dotenv dir.")
# template-dotenv
rows+=("template-dotenv||Generate .env from .env.template.")
# open-with-os
rows+=("open-with-os||Open file or url with default application.")
# open-url-with-delay
rows+=("open-url-with-delay|[url][delay]|Open url after n seconds.")
# show-dotenv-setup
rows+=("show-dotenv-setup||Show info about the dotenv setup.")
# setup-completion
rows+=("setup-completion|[shell]|Show shell completion instructions.")
# Files
Managing files and directories.
# ensure-directory
rows+=("ensure-directory|[path]|Ensure directory path exists.")
# create-symlink
rows+=("create-symlink|[target][source]|Remove existing file/directory and create symlink.")
# create-symlink-files
rows+=("create-symlink-files|[target][source]|Create symlink for files in source pattern.")
# Python
Setup Python virtual enviroment.
# activate-venv
rows+=("activate-venv||Activate or initialize Python virtual env.")
# remove-venv
rows+=("remove-venv||Remove the Python virtual env.")
# Environment
Manage .env files in the task config folder.
TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.build"
# create-dotenv
rows+=("create-dotenv|[env][type]|Create .env file of type nextcloud, odoo, upgrade.")
# list-dotenv
rows+=("list-dotenv||List dotenv files.")
# show-dotenv
rows+=("show-dotenv|[env]|Output content of the .env file.")
# copy-dotenv
rows+=("copy-dotenv|[env][env]|dotenv dotenv file.")
# edit-dotenv
rows+=("edit-dotenv|[env]|Open .env file in default editor.")
# load-dotenv
rows+=("load-dotenv|[env]|Load and export .env file.")
# rename-dotenv
rows+=("rename-dotenv|[env][env]|Rename .env file.")
# remove-dotenv
rows+=("remove-dotenv|[env]|Remove .env file.")
# backup-dotenv-files
rows+=("backup-dotenv-files|[path]|Archive and copy .env files to target location.")
# restore-dotenv-files
rows+=("restore-dotenv-files|[path]|Extract and copy .env files from backup file.")
# LLM
Commands that integrate the llm cli.
# commit-with-llm
rows+=("commit-with-llm||Commit with llm generated commit message.")
# update-with-llm
rows+=("update-with-llm|[glob][prompt]|Feed files matching glob to LLM and apply changes.")
The last parameter can be either a direct prompt string or a path to a text file containing the prompt.
# update-changelog-with-llm
rows+=("update-changelog-with-llm||Update CHANGELOG.md with changes from staged git diff using LLM.")
# create-prompt
rows+=("create-prompt||Create a new prompt file from template.")
# list-prompts
rows+=("list-prompts||List all prompt files.")
# Logging
Colorful logging in task commands.
# log-error
rows+=("log-error||Colored output for errors.")
# log-success
rows+=("log-success||Colored output for success.")
# log-warning
rows+=("log-warning||Colored output for warnings.")
# Git
Manage git folders and submodules.
# commit-git-folder
rows+=("commit-git-folder|[message][path]|Commit all changes in git folders in path.")
# clean-git-folder
rows+=("clean-git-folder||Clean git folder.")
# ls-git-folder
rows+=("ls-git-folder|[path]|Space separated list of git folders in path.")
# push-git-folder
rows+=("push-git-folder||Push all git folders in path.")
# reset-git-folder
rows+=("reset-git-folder||Abort, rebase and reset git folder.")
# stage-git-folder
rows+=("stage-git-folder|[path]|Stage all files in git folders in path.")
# status-git-folder
rows+=("status-git-folder|[path]|Show status of git folders in path.")
# update-submodule
rows+=("update-submodule||Update git submodules.")
# Pass
Load and store secrets from pass.
The name of the entry will resolve dynamically depending on the current directory / project. Use show-dotenv to show info about the dotenv setup.
# save-dotenv-to-pass
rows+=("save-dotenv-to-pass|[file]|Store content of .env in pass entry.")
# load-dotenv-from-pass
rows+=("load-dotenv-from-pass|[file]|Restore content to .env from pass entry.")
# KeePass
Load and store secrets from KeePassXC. Set path to KeePassXC database and entry:
KEEPASS_DATABASE_FILE="/path/to/database.kdbx"
KEEPASS_DATABASE_KEY_FILE="/path/to/keepass.key"
The name of the entry will resolve dynamically depending on the current directory / project. Use show-dotenv to show info about the dotenv setup.
# save-pass-to-keepass
rows+=("save-pass-to-keepass|[pass][entry]|Store password to KeePass entry.")
# get-pass-from-keepass
rows+=("get-pass-from-keepass|[entry]|Get password from KeePass entry.")
# save-dotenv-to-keepass
rows+=("save-dotenv-to-keepass|[file]|Store content of .env in KeePass entry.")
# load-dotenv-from-keepass
rows+=("load-dotenv-from-keepass|[file]|Restore content to .env from KeePass entry.")
# Kubernetes
# save-kubeconfig-to-pass
rows+=("save-kubeconfig-to-pass|[ctx]|Save kubeconfig file in pass.")
# save-kubeconfig-to-keepass
rows+=("save-kubeconfig-to-keepass|[ctx]|Save kubeconfig file in KeePass.")
# load-kubeconfig-from-pass
rows+=("load-kubeconfig-from-pass|[ctx]|Load kubeconfig file from pass.")
# load-kubeconfig-from-keepass
rows+=("load-kubeconfig-from-keepass|[ctx]|Load kubeconfig file from KeePass.")
# Docker
Build and push Docker images. Set Docker env vars.
BUILDX_PLATFORM="linux/amd64"
CONTAINER_REGISTRY="janikvonrotz"
CONTAINER_TAG="python.casa:latest"
DOCKERFILE="image/Dockerfile"
DOCKER_CONFIG="$HOME/.docker/$CONTAINER_REGISTRY/"
# login-docker
rows+=("login-docker|[user][token]|Run Docker login and create docker config.")
# build-image
rows+=("build-image|[output]|Build Docker image with buildx.")
# Ansible
Install scripts from the Ansible Build project.
# install-ansible-build-scripts
The available roles with scripts are listed here: https://ansible.build/scripts.html
rows+=("install-ansible-build-scripts|[role]|Install scripts of the specified Ansbile role.")