#!/bin/sh

find . -type f | xargs -i cp -uv ~/"{}" "{}" 2>&1 |grep -v ^skipped
sed -i "/last updated/clast updated: $(date "+%d%b%Y  +house+" |tr A-Z a-z)" README

echo '<meta charset="utf-8">' >tools.html
find bin -type f | sort -f | xargs -n1 \
  sed -n '/ - /s/# git /# git-/; / - /s/# \([a-z0-9-]\+\)/<li><a href="bin\/\1">\1<\/a>/ip;3q' >>tools.html

#tree -aFH /dotfiles -T /dotfiles --timefmt '%Y-%m-%d' -I '*~|*.swp' . > index.html
cat <<EOF >index.html
<meta charset="utf-8">
<style>body { font-family: monospace; white-space: pre; } a { text-decoration: none }</style>
<pre>
EOF
lr -t 'type == f && name !~~ "*~"' -f '%TF %s <a href="%p">%p</a>%F\n' >>index.html

