From 2165741a249ce1dc3df5fdb8cae6f0c5522588f7 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 15 Sep 2019 07:14:41 -0400 Subject: initial commit --- yamlremote | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 yamlremote diff --git a/yamlremote b/yamlremote new file mode 100755 index 0000000..c102003 --- /dev/null +++ b/yamlremote @@ -0,0 +1,90 @@ +#!/bin/sh +extra_dep=y +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_ <