Files
egutierrez b698177860 feat: funciones pass para gestión de secretos — get, set, list, delete, generate, sync
Wrappers Bash sobre pass (password-store) para CRUD de secretos, generación
de contraseñas y sincronización con git. Incluye script de test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:03:44 +02:00

29 lines
712 B
Bash

# pass_sync
# ---------
# Sincroniza el password store con el repositorio git remoto (pull + push).
# Sale con exit code 1 si la sincronizacion falla.
#
# USO (sourced):
# source pass_sync.sh
# pass_sync
pass_sync() {
local pull_out
pull_out=$(pass git pull 2>&1)
if [ $? -ne 0 ]; then
echo "pass_sync: fallo en git pull: $pull_out" >&2
return 1
fi
local push_out
push_out=$(pass git push 2>&1)
if [ $? -ne 0 ]; then
echo "pass_sync: fallo en git push: $push_out" >&2
return 1
fi
printf '{"pull":"%s","push":"%s"}' \
"$(echo "$pull_out" | tail -1 | sed 's/"/\\"/g')" \
"$(echo "$push_out" | tail -1 | sed 's/"/\\"/g')"
}