Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gomplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ leftDelim: "{{{{"
rightDelim: "}}}}"
inputDir: ./
outputMap: |
./out/{{{{ .in | tmpl.Inline | strings.ReplaceAll ".tmpl" "" }}}}
./{{{{ .in | tmpl.Inline | strings.ReplaceAll ".tmpl" "" }}}}
context:
data:
url: skeleton-data.yaml
1 change: 0 additions & 1 deletion .gomplateignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
.gomplateignore
gomplate.sh
LICENSE
out
skeleton-data.yaml
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,17 @@ gomplate version 0.0.0
4. Modify the included `skeleton-data.yaml` input data file with the appropriate substitution
values for the provided properties for your new project.

5. Run the following command to run gomplate, which will place the templatized
folders and files into the `./out` directory.
5. Stash your input data file in case it is needed later to start over:

```bash
gomplate --verbose
```

6. Next, stash your input data file in case it is needed later to start over:

```bash
git stash push -m "input data backup" -- skeleton-data.yaml
git stash store "$(git stash create)" -m "gomplate input data backup"
```

7. Replace the contents of the static template files with the templatized
folders and files from the `./out` directory.
6. Run the following command to run gomplate, which will replace all contents of the current
directory with the template output.

```bash
ls -A | grep -xv "out" | grep -xv ".git" | xargs rm -rf && \
mv -vf out/{.,}* . ; \
rm -r out
gomplate --verbose
```

- If you need to start the templatization process over, reset the git index to origin/main.
Expand Down
10 changes: 3 additions & 7 deletions gomplate.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#!/usr/bin/env bash
# This script is _destructive_! It runs gomplate and then replaces
# This script is _destructive_! It runs gomplate to replace
# all contents of the current directory with the template output.

git stash store "$(git stash create)" -m "gomplate input data backup"

gomplate --verbose
rc="$?"
if [ $rc -ne 0 ]; then
exit $rc
fi

git stash push -m "gomplate input data backup" -- skeleton-data.yaml

ls -A | grep -xv "out" | grep -xv ".git" | xargs rm -rf && \
mv -vf out/{.,}* . ; \
rm -r out