From c172cc4e6762c47dfd9c590cdbfa24ca914990da Mon Sep 17 00:00:00 2001 From: BarbUk Date: Mon, 28 Oct 2019 15:07:24 +0400 Subject: [PATCH] Handle tmpfile in snippet --- snippy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippy b/snippy index 4578c54..98a6feb 100755 --- a/snippy +++ b/snippy @@ -137,6 +137,10 @@ run() { elif grep -qE "^##noparse" "${snippets_directory}/${snippet}"; then content="$( tail -n +2 "${snippets_directory}/${snippet}" )" + # replace tmpfile for snippets with ##tmpfile header + elif grep -qE "^##tmpfile" "${snippets_directory}/${snippet}"; then + content="$( bashdown_simple <<< "$(tail -n +2 "${snippets_directory}/${snippet}" | sed "s%\$tmpfile%$tmpfile%g" )" )" + # execute bash script in scripts dir elif [[ $(dirname "${snippet}") == 'scripts' ]] && grep -qE "^#!/bin/bash" "${snippets_directory}/${snippet}"; then content="$( bash "${snippets_directory}/${snippet}" )"