#!/bin/sh keep_orig_line=y main() { if [ $# = 0 ]; then while read line; do set -- $line while [ "$1" = - ] do shift done (generate_yaml_remote "$1" "$line") done else for a; do (generate_yaml_remote "$a" "- $a"); done fi } # Example output: # # - location: # git: https://github.com/bitemyapp/esqueleto.git # commit: 08c9b4cdf977d5bcd1baba046a007940c1940758 # extra-dep: true # # And with subdirs: # # - location: # git: d@emmy.childrenofmay.org:public_git/lambdacube-ir # commit: f6617496f582ad287bd8203d931a6ee037ed3a69 # subdirs: # - lambdacube-ir.haskell # - ddl # extra-dep: true # cat, except drop empty lines cat_() { sed -e '/^$/d' } output() { local git_url="$1" git_hash="$2" subdir="$3" orig_line="$4" case "$git_url" in *@*) ;; *) git_url=$(id -un)@$git_url ;; esac cat_ <