dev: automated commit - 2025-07-08 10:25:25

This commit is contained in:
Mariano Z. 2025-07-08 10:25:25 -03:00
parent a9a990ffed
commit 72582c5246
7 changed files with 126 additions and 26 deletions

53
local-bin/.local/bin/stowme Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -e
DOTFILES_REPO=~/dotfiles
DRYRUN=0
# Parseo de dry-run
if [[ "$1" == "--dry-run" || "$1" == "-n" ]]; then
DRYRUN=1
shift
fi
if [ "$#" -ne 2 ]; then
echo "Uso: $0 [--dry-run] <archivo-existente> <directorio-en-repo>"
echo "Ejemplo: $0 .zshrc zsh"
exit 1
fi
SRC_ORIGINAL="$1"
SUBDIR="$2"
# Obtener path absoluto del archivo origen
SRC="$(realpath "$SRC_ORIGINAL")"
# Obtener nombre relativo (ej: .zshrc o config/nvim/init.vim)
BASENAME=$(basename "$SRC_ORIGINAL")
DST_DIR="$DOTFILES_REPO/$SUBDIR"
DST="$DST_DIR/$BASENAME"
if [ ! -e "$SRC" ]; then
echo "❌ El archivo $SRC no existe."
exit 1
fi
if [ "$DRYRUN" -eq 1 ]; then
echo "=== DRY RUN ==="
echo "📁 Crear directorio si no existe: $DST_DIR"
echo "📦 Mover: $SRC → $DST"
echo "🔗 Ejecutar: (cd $DOTFILES_REPO && stow -nv $SUBDIR)"
else
echo "📁 Creando directorio: $DST_DIR"
mkdir -p "$DST_DIR"
echo "📦 Moviendo archivo: $SRC → $DST"
mv "$SRC" "$DST"
echo "🔗 Ejecutando stow"
cd "$DOTFILES_REPO"
stow "$SUBDIR"
echo "✅ Listo: $BASENAME stoweado."
fi