feat(dotenv): rename env utilities to dotenv and enhance list-dotenv with project files
- Renamed all env-related scripts to use dotenv naming convention (copy-env → copy-dotenv, create-env → create-dotenv, etc.) - Updated documentation in library.md and task.template to reflect new script names and .env file references - Enhanced list-dotenv to also display .env.* files in current directory with type classification (Project/Template) - Added new show-dotenv-setup script to display KeePass/Pass entry details - Removed deprecated show-env script in favor of show-dotenv - Updated install script to reflect renamed scripts and added show-dotenv-setup - Improved consistency in output messages (e.g., "Init .env file" instead of "Init env file")
This commit is contained in:
14 files changed
+87
-74
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
copy-env() {
|
||||
copy-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
if [[ -z "$2" ]]; then echo "\$2 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
create-env() {
|
||||
create-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
if [[ -z "$2" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
@@ -12,7 +12,7 @@ create-env() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Init env file: $env_filepath"
|
||||
echo "Init .env file: $env_filepath"
|
||||
|
||||
if [[ "$2" == "odoo" ]]; then
|
||||
echo "ODOO_URL=$ODOO_URL" > "$env_filepath"
|
||||
@@ -45,5 +45,5 @@ create-env() {
|
||||
echo "TARGET_DATABASE='upgrade'" >> "$env_filepath"
|
||||
fi
|
||||
|
||||
echo "Edit with: task edit-env $1"
|
||||
echo "Edit with: task edit-dotenv $1"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
edit-env() {
|
||||
edit-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
local env_filepath="$TASK_DOTENV_DIR/.env.$1"
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
list-env() {
|
||||
list-dotenv() {
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
# Define column widths
|
||||
@@ -27,4 +27,17 @@ list-env() {
|
||||
printf "| %-${name_width}s | %-${type_width}s |\n" "$env_name" "$env_type"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process files in current directory (PWD)
|
||||
for env_file in .env.*; do
|
||||
if [[ -f "$env_file" ]]; then
|
||||
local env_name="${env_file##*/}"
|
||||
env_name="${env_name#.env.}"
|
||||
local env_type="Project"
|
||||
if [[ "$env_name" == "template" ]]; then
|
||||
env_type="Template"
|
||||
fi
|
||||
printf "| %-${name_width}s | %-${type_width}s |\n" "$env_name" "$env_type"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
load-env() {
|
||||
load-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
remove-env() {
|
||||
remove-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rename-env() {
|
||||
rename-dotenv() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
if [[ -z "$2" ]]; then echo "\$2 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
restore-env-files() {
|
||||
restore-dotenv-files() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
local backup_filepath="$1"
|
||||
|
||||
echo "Restore env files from: $backup_filepath"
|
||||
echo "Restore .env files from: $backup_filepath"
|
||||
mkdir -p "$TASK_DOTENV_DIR"
|
||||
tar -xzf "$backup_filepath" -C "$TASK_DOTENV_DIR"
|
||||
}
|
||||
+9
-6
@@ -1,10 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
show-dotenv() {
|
||||
PASS_ENTRY=$(echo "env/${PWD##*/}#$(git symbolic-ref --short -q HEAD)" | tr '[:upper:]' '[:lower:]')
|
||||
KEEPASS_ENTRY=$(echo "env/${PWD##*/}#$(git symbolic-ref --short -q HEAD)" | tr '[:upper:]' '[:lower:]')
|
||||
echo "KeePass Database File: $KEEPASS_DATABASE_FILE"
|
||||
echo "KeePass Database Key File: $KEEPASS_DATABASE_KEY_FILE"
|
||||
echo "KeePass Entry: $KEEPASS_ENTRY"
|
||||
echo "Pass Entry: $PASS_ENTRY"
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
local env_filepath="$TASK_DOTENV_DIR/.env.$1"
|
||||
if [[ ! -f "$env_filepath" ]]; then
|
||||
echo "Environment '$1' not found."
|
||||
return 1 # Exit with non-zero status if file does not exist
|
||||
fi
|
||||
cat "$env_filepath" | sed 's/^/export /'
|
||||
}
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
show-dotenv-setup() {
|
||||
PASS_ENTRY=$(echo "env/${PWD##*/}#$(git symbolic-ref --short -q HEAD)" | tr '[:upper:]' '[:lower:]')
|
||||
KEEPASS_ENTRY=$(echo "env/${PWD##*/}#$(git symbolic-ref --short -q HEAD)" | tr '[:upper:]' '[:lower:]')
|
||||
echo "KeePass Database File: $KEEPASS_DATABASE_FILE"
|
||||
echo "KeePass Database Key File: $KEEPASS_DATABASE_KEY_FILE"
|
||||
echo "KeePass Entry: $KEEPASS_ENTRY"
|
||||
echo "Pass Entry: $PASS_ENTRY"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
show-env() {
|
||||
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
local env_filepath="$TASK_DOTENV_DIR/.env.$1"
|
||||
if [[ ! -f "$env_filepath" ]]; then
|
||||
echo "Environment '$1' not found."
|
||||
return 1 # Exit with non-zero status if file does not exist
|
||||
fi
|
||||
cat "$env_filepath" | sed 's/^/export /'
|
||||
}
|
||||
@@ -6,23 +6,23 @@ repository=https://taskfile.build
|
||||
# ls -1 bin | sed '/install/d'
|
||||
scripts=(
|
||||
activate-venv
|
||||
backup-env-files
|
||||
backup-dotenv-files
|
||||
build-image
|
||||
clean-git-folder
|
||||
commit-git-folder
|
||||
commit-with-llm
|
||||
copy-env
|
||||
create-env
|
||||
copy-dotenv
|
||||
create-dotenv
|
||||
create-symlink
|
||||
create-symlink-files
|
||||
edit-env
|
||||
edit-dotenv
|
||||
ensure-directory
|
||||
get-pass-from-keepass
|
||||
init-dotenv-dir
|
||||
list-env
|
||||
list-dotenv
|
||||
load-dotenv-from-keepass
|
||||
load-dotenv-from-pass
|
||||
load-env
|
||||
load-dotenv
|
||||
load-kubeconfig-from-keepass
|
||||
load-kubeconfig-from-pass
|
||||
log-error
|
||||
@@ -33,18 +33,18 @@ ls-git-folder
|
||||
open-url-with-delay
|
||||
open-with-os
|
||||
push-git-folder
|
||||
remove-env
|
||||
remove-dotenv
|
||||
remove-venv
|
||||
rename-env
|
||||
rename-dotenv
|
||||
reset-git-folder
|
||||
restore-env-files
|
||||
restore-dotenv-files
|
||||
save-dotenv-to-keepass
|
||||
save-dotenv-to-pass
|
||||
save-kubeconfig-to-keepass
|
||||
save-kubeconfig-to-pass
|
||||
save-pass-to-keepass
|
||||
show-dotenv-setup
|
||||
show-dotenv
|
||||
show-env
|
||||
stage-git-folder
|
||||
status-git-folder
|
||||
template-dotenv
|
||||
|
||||
+22
-22
@@ -78,10 +78,10 @@ printf "$column" 'open-with-os' '' 'Open file or url with default application.'
|
||||
printf "$column" 'open-url-with-delay' '[url][delay]' 'Open url after n seconds.'
|
||||
```
|
||||
|
||||
### show-dotenv
|
||||
### show-dotenv-setup
|
||||
|
||||
```bash
|
||||
printf "$column" 'show-dotenv' '' 'Show info about the dotenv setup.'
|
||||
printf "$column" 'show-dotenv-setup' '' 'Show info about the dotenv setup.'
|
||||
```
|
||||
|
||||
## Files
|
||||
@@ -130,64 +130,64 @@ Manage `.env` files in the task config folder.
|
||||
TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.build"
|
||||
```
|
||||
|
||||
### create-env
|
||||
### create-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'create-env' '[env][type]' 'Create env file of type nextcloud, odoo, upgrade.'
|
||||
printf "$column" 'create-dotenv' '[env][type]' 'Create .env file of type nextcloud, odoo, upgrade.'
|
||||
```
|
||||
|
||||
### list-env
|
||||
### list-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'list-env' '' 'List env files.'
|
||||
printf "$column" 'list-dotenv' '' 'List .env files.'
|
||||
```
|
||||
|
||||
### show-env
|
||||
### show-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'show-env' '[env]' 'Output content of the env file.'
|
||||
printf "$column" 'show-dotenv' '[env]' 'Output content of the .env file.'
|
||||
```
|
||||
|
||||
### copy-env
|
||||
### copy-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'copy-env' '[env][env]' 'Copy env file.'
|
||||
printf "$column" 'copy-dotenv' '[env][env]' 'dotenv .env file.'
|
||||
```
|
||||
|
||||
### edit-env
|
||||
### edit-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'edit-env' '[env]' 'Open env file in default editor.'
|
||||
printf "$column" 'edit-dotenv' '[env]' 'Open .env file in default editor.'
|
||||
```
|
||||
|
||||
### load-env
|
||||
### load-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'load-env' '[env]' 'Load and export env file.'
|
||||
printf "$column" 'load-dotenv' '[env]' 'Load and export .env file.'
|
||||
```
|
||||
|
||||
### rename-env
|
||||
### rename-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'rename-env' '[env][env]' 'Rename env file.'
|
||||
printf "$column" 'rename-dotenv' '[env][env]' 'Rename .env file.'
|
||||
```
|
||||
|
||||
### remove-env
|
||||
### remove-dotenv
|
||||
|
||||
```bash
|
||||
printf "$column" 'remove-env' '[env]' 'Remove environment config.'
|
||||
printf "$column" 'remove-dotenv' '[env]' 'Remove .env file.'
|
||||
```
|
||||
|
||||
### backup-env-files
|
||||
### backup-dotenv-files
|
||||
|
||||
```bash
|
||||
printf "$column" 'backup-env-files' '[path]' 'Archive and copy env files to target location.'
|
||||
printf "$column" 'backup-dotenv-files' '[path]' 'Archive and copy .env files to target location.'
|
||||
```
|
||||
|
||||
### restore-env-files
|
||||
### restore-dotenv-files
|
||||
|
||||
```bash
|
||||
printf "$column" 'restore-env-files' '[path]' 'Extract and copy env files from backup file.'
|
||||
printf "$column" 'restore-dotenv-files' '[path]' 'Extract and copy .env files from backup file.'
|
||||
```
|
||||
|
||||
## LLM
|
||||
|
||||
+12
-12
@@ -7,8 +7,8 @@ if [[ -a ".env" ]]; then
|
||||
fi
|
||||
|
||||
help-table() {
|
||||
local cmd_width=24
|
||||
local opt_width=18
|
||||
local cmd_width=30
|
||||
local opt_width=16
|
||||
local desc_width=50
|
||||
local column="| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n"
|
||||
|
||||
@@ -29,16 +29,16 @@ help-table() {
|
||||
printf "$column" 'activate-venv' '' 'Activate or initialize Python virtual env.'
|
||||
printf "$column" 'remove-venv' '' 'Remove the Python virtual env.'
|
||||
# Environment
|
||||
printf "$column" 'create-env' '[env][type]' 'Create env file of type nextcloud, odoo, upgrade.'
|
||||
printf "$column" 'list-env' '' 'List env files.'
|
||||
printf "$column" 'show-env' '[env]' 'Output content of the env file.'
|
||||
printf "$column" 'copy-env' '[env][env]' 'Copy env file.'
|
||||
printf "$column" 'edit-env' '[env]' 'Open env file in default editor.'
|
||||
printf "$column" 'load-env' '[env]' 'Load and export env file.'
|
||||
printf "$column" 'rename-env' '[env][env]' 'Rename env file.'
|
||||
printf "$column" 'remove-env' '[env]' 'Remove environment config.'
|
||||
printf "$column" 'backup-env-files' '[path]' 'Archive and copy env files to target location.'
|
||||
printf "$column" 'restore-env-files' '[path]' 'Extract and copy env files from backup file.'
|
||||
printf "$column" 'create-dotenv' '[env][type]' 'Create env file of type nextcloud, odoo, upgrade.'
|
||||
printf "$column" 'list-dotenv' '' 'List .env files.'
|
||||
printf "$column" 'show-dotenv' '[env]' 'Output content of the .env file.'
|
||||
printf "$column" 'copy-dotenv' '[env][env]' 'Copy .env file.'
|
||||
printf "$column" 'edit-dotenv' '[env]' 'Open env file in default editor.'
|
||||
printf "$column" 'load-dotenv' '[env]' 'Load and export .env file.'
|
||||
printf "$column" 'rename-dotenv' '[env][env]' 'Rename .env file.'
|
||||
printf "$column" 'remove-dotenv' '[env]' 'Remove environment config.'
|
||||
printf "$column" 'backup-dotenv-files' '[path]' 'Archive and copy .env files to target location.'
|
||||
printf "$column" 'restore-dotenv-files' '[path]' 'Extract and copy .env files from backup file.'
|
||||
# LLM
|
||||
printf "$column" 'commit-with-llm' '' 'Commit with llm generated commit message.'
|
||||
printf "$column" 'update-with-llm' '[glob][prompt]' 'Feed files matching glob to LLM and apply changes.'
|
||||
|
||||
Reference in new issue
Block a user