- Updated `task`, `task.template`, and `library.md` to use angle brackets (`<param>`) for required parameters and square brackets (`[param]`) for optional ones. - Fixed argument order mismatches in `create-symlink`, `create-symlink-files`, and `commit-git-folder` documentation. - Removed non-existent `[path]` parameter from `merge-git-remote`. - Standardized empty-argument error messages across `bin/*` scripts to use slash notation (e.g., `$1/path is empty.`). - Updated prompt file `prompts/21_show-optional-and-required-params-in-task-help.md` to mark task as completed and log work.
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
save-pass-to-keepass() {
|
|
if [[ -z "$1" ]]; then
|
|
echo "\$1/password is empty."
|
|
exit 1
|
|
fi
|
|
if [[ -z "$2" ]]; then
|
|
echo "\$2/entry path is empty."
|
|
exit 1
|
|
fi
|
|
|
|
local password="$1"
|
|
local keepass_entry="$2"
|
|
|
|
if [[ ! -f "$KEEPASS_DATABASE_FILE" ]]; then
|
|
echo "Keepass database file not found: $KEEPASS_DATABASE_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$KEEPASS_DATABASE_KEY_FILE" ]]; then
|
|
echo "Keepass database key file not found: $KEEPASS_DATABASE_KEY_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Prompt for KeePass database password silently
|
|
read -s -p "Enter password to unlock $KEEPASS_DATABASE_FILE: " keepass_database_pass
|
|
echo # Add a newline after password input
|
|
|
|
echo "Saving password to keepass entry: $keepass_entry"
|
|
echo "$keepass_database_pass" | keepassxc-cli add \
|
|
--key-file "$KEEPASS_DATABASE_KEY_FILE" \
|
|
--password-prompt \
|
|
"$KEEPASS_DATABASE_FILE" \
|
|
"$keepass_entry" <<< "$password"
|
|
}
|
|
sptk() {
|
|
save-pass-to-keepass "$@"
|
|
}
|