Files
git.taskfile.build/library.md
T
Janik von Rotz 71b3e85580 feat(cli): add scripts for KeePass password management
- Add `get-pass-from-keepass` script to retrieve passwords from KeePass entries
- Add `save-pass-to-keepass` script to store passwords in KeePass entries
- Update library.md documentation with new KeePass utility functions
- Include usage examples and descriptions for new password management tools
2025-11-14 16:44:29 +01:00

226 lines
4.2 KiB
Markdown

---
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 regularly.
```bash
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.
```bash
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
```bash
printf "$column" "init-config-dir" "" "Setup task file config dir."
```
### template-dotenv
```bash
printf "$column" "template-dotenv" "" "Generate .env from .env.template."
```
## Python
### activate-venv
```bash
printf "$column" "activate-venv" "" "Activate or initialize Python virtual env."
```
## Environment
### create-odoo-env
```bash
printf "$column" "create-odoo-env" "[env]" "Create env file for Odoo instance."
```
### create-nextcloud-env
```bash
printf "$column" "create-nextcloud-env" "[env]" "Create env file for Nextcloud Instance."
```
### list-env
```bash
printf "$column" "list-env" "" "List env files."
```
### show-env
```bash
printf "$column" "show-env" "[env]" "Output content of the env file."
```
### copy-env
```bash
printf "$column" "copy-env" "[env][env]" "Copy env file."
```
### edit-env
```bash
printf "$column" "edit-env" "[env]" "Open env file in default editor."
```
### load-env
```bash
printf "$column" "load-env" "[env]" "Load and export env file."
```
### rename-env
```bash
printf "$column" "rename-env" "[env][env]" "Rename env file."
```
### remove-env
```bash
printf "$column" "remove-env" "[env]" "Remove environment config."
```
### backup-env-files
```bash
printf "$column" "backup-env-files" "[path]" "Archive and copy env files to target location."
```
### restore-env-files
```bash
printf "$column" "restore-env-files" "[path]" "Extract and copy env files from backup file."
```
## LLM
### commit-with-llm
```bash
printf "$column" "commit-with-llm" "" "Commit with llm generated commit message."
```
### update-with-llm
```bash
printf "$column" "update-with-llm" "[glob][prompt]" "Feed files matching glob to LLM and apply changes."
```
## Git
### update-submodule
```bash
printf "$column" "update-submodule" "" "Update git submodules."
```
## Pass
Set path to pass entry.
```bash
PASS_ENTRY=$(echo "env/${PWD##*/}" | tr '[:upper:]' '[:lower:]')
```
### save-dotenv-to-pass
```bash
printf "$column" "save-dotenv-to-pass" "" "Store content of .env in pass entry."
```
### load-dotenv-from-pass
```bash
printf "$column" "load-dotenv-from-pass" "" "Restore content to .env from pass entry."
```
## KeePass
Set path to KeePass database and entry.
```bash
KEEPASS_DATABASE_FILE="/path/to/database.kdbx"
KEEPASS_DATABASE_KEY_FILE="/path/to/keepass.key"
KEEPASS_ENTRY=$(echo "env/${PWD##*/}" | tr '[:upper:]' '[:lower:]')
```
### save-pass-to-keepass
```bash
printf "$column" "save-pass-to-keepass" "[pass][entry]" "Store password to KeePass entry."
```
### get-pass-from-keepass
```bash
printf "$column" "get-pass-from-keepass" "[entry]" "Get password from KeePass entry."
```
### save-dotenv-to-keepass
```bash
printf "$column" "save-dotenv-to-keepass" "" "Store content of .env in KeePass entry."
```
### load-dotenv-from-keepass
```bash
printf "$column" "load-dotenv-from-keepass" "" "Restore content to .env from KeePass entry."
```
## Docker
Set Docker env vars.
```bash
BUILDX_PLATFORM="linux/amd64"
CONTAINER_REGISTRY="janikvonrotz"
CONTAINER_TAG="python.casa:latest"
DOCKERFILE="image/Dockerfile"
DOCKER_CONFIG="$HOME/.docker/$CONTAINER_REGISTRY/"
```
### login-docker
```bash
printf "$column" "login-docker" "[user][token]" "Run Docker login and create docker config."
```
### build-image
```bash
printf "$column" "build-image" "[output]" "Build Docker image with buildx."
```