diff options
Diffstat (limited to 'bin/aux')
| -rwxr-xr-x | bin/aux | 51 |
1 files changed, 29 insertions, 22 deletions
@@ -69,28 +69,35 @@ shift $((OPTIND - 1)) D="${XDG_DATA_HOME:-$HOME/.local/share}"/aux-repo cp_all() { - for f in "$@"; do - mkdir -p "$(dirname "$f")" - cp -v "$D/$f" "$f" - done + from="$1" + to="$2" + mkdir -p "$(dirname "$to")" + echo "cp '$from' '$to'" + ifnew "$to" < "$from" + if [ -x "$from" ]; then + chmod +x "$to" + fi +} + +cp_if() { + from="$1" + to="$2" + if [ -e "$to" ]; then + cp_all "$from" "$to" + fi } -FILES=' -aux/.gitignore -aux/lib.sh -aux/tld.txt -aux/workflow/favicon.svg -aux/workflow/head.html -aux/workflow/md2html.sh -aux/workflow/style.css -aux/workflow/preamble.md.in -aux/workflow/TODOs.sh -aux/ci/report.sh -' +cp_empty() { + from="$1" + to="$2" + if [ -e "$to" ] && [ ! -s "$to" ]; then + cp_all "$from" "$to" + fi +} -if [ $# = 0 ]; then - # shellcheck disable=2086 - cp_all $FILES -else - cp_all "$@" -fi +for d in "$D"/cases/*/; do + fn="$(basename "$d")" + find "$d" -not -type d | while read -r f; do + "$fn" "$f" "${f#"$D/cases/$fn/"}" + done +done |
