docs(templates): correct example for matchP helper function
Some checks are pending
Code QL / code-ql (push) Waiting to run
Azure Static Web Apps CI/CD / Build and Deploy (push) Waiting to run

This commit is contained in:
L. Yeung 2024-08-05 11:59:41 +08:00 committed by Jan De Dobbeleer
parent 2000811db0
commit 69556d6fb6

View file

@ -171,16 +171,16 @@ use them.
<!-- markdownlint-disable MD013 -->
| Template | Description |
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `{{ url .UpstreamIcon .UpstreamURL }}` | Create an `OSC8` hyperlink to a website to open your default browser (needs terminal [support][terminal-list-hyperlinks]). |
| `{{ path .Path .Location }}` | Create an `OSC8` file link to a folder to open your file explorer (needs terminal [support][terminal-list-hyperlinks]). |
| `{{ secondsRound 3600 }}` | Round seconds to a time indication. In this case the output is `1h`. |
| `{{ if glob "*.go" }}OK{{ else }}NOK{{ end }}` | Exposes [filepath.Glob][glob] as a boolean template function. |
| `{{ if matchP "*.Repo" .Path }}Repo{{ else }}No Repo{{ end }}` | Exposes [regexp.MatchString][regexpms] as a boolean template function. |
| `{{ replaceP "c.t" "cut code cat" "dog" }}` | Exposes [regexp.ReplaceAllString][regexpra] as a string template function. |
| <code>\{\{ .Code &vert; hresult \}\}</code> | Transform a status code to its HRESULT value for easy troubleshooting. For example `-1978335212` becomes `0x8A150014`. |
| `{{ readFile ".version.json" }}` | Read a file in the current directory. Returns a string. |
| Template | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `{{ url .UpstreamIcon .UpstreamURL }}` | Create an `OSC8` hyperlink to a website to open your default browser (needs terminal [support][terminal-list-hyperlinks]). |
| `{{ path .Path .Location }}` | Create an `OSC8` file link to a folder to open your file explorer (needs terminal [support][terminal-list-hyperlinks]). |
| `{{ secondsRound 3600 }}` | Round seconds to a time indication. In this case the output is `1h`. |
| `{{ if glob "*.go" }}OK{{ else }}NOK{{ end }}` | Exposes [filepath.Glob][glob] as a boolean template function. |
| `{{ if matchP ".*\\.Repo$" .Path }}Repo{{ else }}No Repo{{ end }}` | Exposes [regexp.MatchString][regexpms] as a boolean template function. |
| `{{ replaceP "c.t" "cut code cat" "dog" }}` | Exposes [regexp.ReplaceAllString][regexpra] as a string template function. |
| <code>\{\{ .Code &vert; hresult \}\}</code> | Transform a status code to its HRESULT value for easy troubleshooting. For example `-1978335212` becomes `0x8A150014`. |
| `{{ readFile ".version.json" }}` | Read a file in the current directory. Returns a string. |
<!-- markdownlint-enable MD013 -->