Skip to content

Commit

Permalink
chore(mdtmpl): run mdtmpl
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoSuessgott committed Oct 7, 2024
1 parent 522786d commit e900cfa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ repos:
args: [--autofix, --no-sort-keys]

- repo: https://github.com/FalcoSuessgott/mdtmpl
rev: v0.0.4
rev: v0.0.5
hooks:
# example
- id: mdtmpl
args: [-t=examples/README.md.tmpl, -f, -o=examples/README.md]
# readme
- id: mdtmpl
args: [-f]
stages: [commit-msg]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Tired of copy-pasting your example configurations or bumping hardcoded versions
* `{{ code "<highlighting>" "<content>" }}`: which will wrap the given content in a code block using the specified syntax highlighting
* `{{ exec "<command>" }}`: executes the given command and returns its output
* `{{ tmpl "<template-file>" }}`: to include and render another template file
* `{{ tmplWithVars "<template-file>" "<key>=<value>" "<key>=<value>"}}`: to include and render another template file with additional vars in the form of `<key>=<value>`
* `{{ tmplWithVars "<template-file>" "<key>=<value>" "<key>=<value>"}}`: to include and render another template file with additional vars in the form of `<key>=<value>`
* `{{ conventionalCommitBump }}`: will result to the next semantic version according to the latest git commit message.

You can also pipe the output of one instruction to the next one as its last parameter:
Expand Down Expand Up @@ -82,14 +82,14 @@ Flags:
```

# pre-commit hook
Add the following config to your `.pre-commit-config.yaml` file and adjust the `args` to your need:
<!--- {{ tmpl "docs/pre-commit.tmpl" | code "yaml" }} --->
Add the following config to your `.pre-commit-config.yaml` file and adjust the `args` to your needs.
Mae sure to run `pre-commit install` and `pre-commit autoupdate` to stay on the last version:
<!--- {{ tmpl "docs/pre-commit.tmpl" | truncate | code "yaml" }} --->
```yaml
repos:
- repo: https://github.com/FalcoSuessgott/mdtmpl
rev: v0.0.4
rev: v0.1.0
hooks:
- id: mdtmpl
args: [-t=README.md.tmpl, -f, -o=README.md]
```
5 changes: 3 additions & 2 deletions README.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ chmod u+x mdtmpl
<!--- {{ exec "echo \"$> mdtmpl -h\" && go run main.go -h" | truncate | code "bash" }} --->

# pre-commit hook
Add the following config to your `.pre-commit-config.yaml` file and adjust the `args` to your need:
<!--- {{ tmpl "docs/pre-commit.tmpl" | code "yaml" }} --->
Add the following config to your `.pre-commit-config.yaml` file and adjust the `args` to your needs.
Mae sure to run `pre-commit install` and `pre-commit autoupdate` to stay on the last version:
<!--- {{ tmpl "docs/pre-commit.tmpl" | truncate | code "yaml" }} --->
1 change: 1 addition & 0 deletions docs/intro.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Tired of copy-pasting your example configurations or bumping hardcoded versions
* `{{ exec "<command>" }}`: executes the given command and returns its output
* `{{ tmpl "<template-file>" }}`: to include and render another template file
* `{{ tmplWithVars "<template-file>" "<key>=<value>" "<key>=<value>"}}`: to include and render another template file with additional vars in the form of `<key>=<value>`
* `{{ conventionalCommitBump }}`: will result to the next semantic version according to the latest git commit message.

You can also pipe the output of one instruction to the next one as its last parameter:

Expand Down
9 changes: 8 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ HELLO!HELLO!HELLO!HELLO!HELLO!
<!--- {{ tmpl "examples/template.tmpl" }} --->
repos:
- repo: https://github.com/FalcoSuessgott/mdtmpl
rev: v0.0.4
rev: v0.1.0
hooks:
- id: mdtmpl
args: [-t=README.md.tmpl, -f, -o=README.md]
Expand All @@ -41,3 +41,10 @@ repos:
> You can include other templates `{{ tmplWithVars "examples/templateWithVars.tmpl" "version=v1.0.0" "name=kuberbernetes" }}`:
<!--- {{ tmplWithVars "examples/templateWithVars.tmpl" "version=v1.0.0" "name=kuberbernetes" }} --->
This is another template kuberbernetes-v1.0.0


## bump versions based on the latest commit message
> The template func `conventionalCommitBump` allows you to bump a specified version by using the latest git tag & commit message.
`mdtmpl` will read the latest commit message from `.git/COMMIT_EDITMSG` parse it to a conventional commit and then return the next semantic version based on the latest git tag: `{{ conventionalCommitBump }}`:
<!--- {{ conventionalCommitBump }} --->
v0.1.0
2 changes: 1 addition & 1 deletion examples/README.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ This is an example `README.md.tmpl` showing the features of `mktmpl`.

## bump versions based on the latest commit message
> The template func `conventionalCommitBump` allows you to bump a specified version by using the latest git tag & commit message.
`mdtmpl` will read the latest commit message from `.git/COMMIT_EDITMSG` parse it to a convetional commit and then return the next semantic version based on the latest git tag: `{{ conventionalCommitBump }}`:
`mdtmpl` will read the latest commit message from `.git/COMMIT_EDITMSG` parse it to a conventional commit and then return the next semantic version based on the latest git tag: `{{ conventionalCommitBump }}`:
<!--- {{ conventionalCommitBump }} --->

0 comments on commit e900cfa

Please sign in to comment.