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>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# 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')"
|
||||
}
|
||||
Reference in New Issue
Block a user