- Split README.md into usage.md and library.md for better organization - Move library section to its own page and update references - Rename "Usage" section to "Examples" in README.md - Update navigation links in base layout to reflect new structure - Fix typo in function definition in image/README.md - Add frontmatter to AGENTS.md for proper layout rendering - Update footer link from GitHub to Codeberg
4.0 KiB
4.0 KiB
layout
| layout |
|---|
| layouts/base.njk |
Library
The repository of this website provides a library of reusable functions.
Clone the repository into your home folder and ensure it is updated regurarly.
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 you can import these functions 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
Task
For autocomplete add the command to the help table.
init-config-dir
printf "$column" "init-config-dir" "" "Setup task file config dir."
template-dotenv
printf "$column" "template-dotenv" "" "Generate .env from .env.template."
Python
Set git env vars.
GIT_BRANCH=$(git symbolic-ref --short -q HEAD)
init-venv
printf "$column" "init-venv" "" "Initialize and activate Python virtual env."
Environment
create-odoo-env
printf "$column" "create-odoo-env" "[env]" "Create env file for Odoo instance."
create-nextcloud-env
printf "$column" "create-nextcloud-env" "[env]" "Create env file for Nextcloud Instance."
list-env
printf "$column" "list-env" "" "List env files."
show-env
printf "$column" "show-env" "[env]" "Output content of the env file."
copy-env
printf "$column" "copy-env" "[env][env]" "Copy env file."
edit-env
printf "$column" "edit-env" "[env]" "Open env file in default editor."
load-env
printf "$column" "load-env" "[env]" "Load and export env file."
rename-env
printf "$column" "rename-env" "[env][env]" "Rename env file."
remove-env
printf "$column" "remove-env" "[env]" "Remove environment config."
backup-env-files
printf "$column" "backup-env-files" "[path]" "Archive and copy env files to target location."
restore-env-files
printf "$column" "restore-env-files" "[path]" "Extract and copy env files from backup file."
LLM
commit-with-llm
printf "$column" "commit-with-llm" "" "Commit with llm generated commit message."
update-with-llm
printf "$column" "update-with-llm" "[glob][prompt]" "Feed files matching glob to LLM and apply changes."
Git
update-submodule
printf "$column" "update-submodule" "" "Update git submodules."
Pass
Set path to pass entry.
PASS_ENTRY=$(echo "env/${PWD##*/}" | tr '[:upper:]' '[:lower:]')
save-dotenv-to-pass
printf "$column" "save-dotenv-to-pass" "" "Store content of .env in pass entry."
load-dotenv=from-pass
printf "$column" "load-dotenv=from-pass" "" "Restore content to .env from pass entry."
KeePass
Set path to KeePass database and entry.
KEEPASS_DATABASE_FILE="/path/to/database.kdbx"
KEEPASS_DATABASE_KEY_FILE="/path/to/keepass.key"
KEEPASS_ENTRY=$(echo "env/${PWD##*/}" | tr '[:upper:]' '[:lower:]')
save-dotenv-to-keepass
printf "$column" "save-dotenv-to-keepass" "" "Store content of .env in KeePass entry."
load-dotenv-from-keepass
printf "$column" "load-dotenv-from-keepass" "" "Restore content to .env from KeePass entry."
Docker
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
printf "$column" "login-docker" "[user][token]" "Run Docker login and create docker config."
build-image
printf "$column" "build-image" "" "Build Docker image with buildx."