#!/bin/sh set -eu INDEX="$1" PROJECTS="$(cut -d':' -f1 "$INDEX")" COMMANDS="tidy get build test up" expand() { local prefix="$1" suffix="$2" local x= out= shift 2 for x; do out="${out:+$out }${prefix}$x${suffix}" done echo "$out" } prefixed() { local prefix="${1:+$1-}" shift expand "$prefix" "" "$@" } suffixed() { local suffix="${1:+-$1}" shift expand "" "$suffix" "$@" } # packed remove excess whitespace from lines of commands packed() { sed -e 's/^[ \t]\+//' -e 's/[ \t]\+$//' -e '/^$/d;' -e '/^#/d'; } # packet_oneline converts a multiline script into packed single-line equivalent packed_oneline() { packed | tr '\n' ';' | sed -e 's|;$||' -e 's|then;|then |g' -e 's|;[ \t]*|; |g' } gen_install_tools() { cat <