From c2abac42cee303508923fbdd64f711bb26b0928d Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Sun, 26 Apr 2020 23:22:05 +0200 Subject: [PATCH] feat: Propose to create a subfolder before generating coq-action.yml --- generate.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generate.sh b/generate.sh index f7b5e8a..cad4b13 100755 --- a/generate.sh +++ b/generate.sh @@ -2,6 +2,8 @@ srcdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd ) +function ask1() { local yn; echo -n "$* [Y/n] "; read -r -n 1 yn; [[ "$yn" =~ [Yy] ]] && echo && return 0; [ -z "$yn" ] && return 0; echo; return 1; } + for f in "$srcdir"/{,.}*.mustache; do target=$(basename "$f" .mustache) case "$target" in @@ -9,6 +11,10 @@ for f in "$srcdir"/{,.}*.mustache; do shortname=$(grep -e "shortname:" meta.yml | sed -e "s/^shortname: //") target=${target/coq/coq-$shortname} ;; + coq-action.yml) + ask1 "Do you want to create a .github/workflows subfolder for coq-action.yml?" && + { mkdir -p .github/workflows; target=".github/workflows/$target"; } + ;; esac echo "Generating $target..." mustache meta.yml "$f" > "$target"