obsidian_kitty_setup/lib/render.sh
Vadym Samoilenko d31fbf9c99 Initial dotfiles setup — Kitty + Obsidian logging system
- GNU Stow packages: kitty, fish, nvim, btop, fastfetch, starship, git, claude
- install.sh with modular install, template rendering, fish plugins setup
- uninstall.sh (stow -D) and scripts/doctor.sh for health checks
- Brewfile (macOS) + Aptfile (Linux servers)
- Claude Code hooks pipeline: settings.json.tpl, Obsidian session logging scripts
- memory-compiler inline copy with env-var-based paths
- Python scripts patched: os.environ.get() for OBSIDIAN_VAULT + PROJECTS_ROOT
- fish/config.fish: platform-aware Homebrew PATH (macOS + Linuxbrew)
- .env.example template for ~/.dotfiles.env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 12:57:30 +01:00

30 lines
859 B
Bash

#!/usr/bin/env bash
# lib/render.sh — envsubst-based template rendering
# render_templates REPO_DIR
# Finds all *.tpl files under REPO_DIR and renders them (output: same path without .tpl)
render_templates() {
local repo_dir="$1"
step "Rendering templates"
# Ensure gettext (envsubst) is available
if ! has_cmd envsubst; then
if is_macos; then
warn "envsubst not found — installing gettext via Homebrew..."
brew install gettext
export PATH="/opt/homebrew/opt/gettext/bin:$PATH"
else
sudo apt-get install -y gettext-base 2>/dev/null
fi
fi
local count=0
while IFS= read -r tpl; do
local out="${tpl%.tpl}"
envsubst < "$tpl" > "$out"
success "Rendered $(basename "$out")"
((count++))
done < <(find "$repo_dir" -name "*.tpl" -not -path "*/.git/*")
info "$count template(s) rendered."
}