mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-27 20:09:39 -08:00
docs(templates): correct example for matchP
helper function
This commit is contained in:
parent
2000811db0
commit
69556d6fb6
|
@ -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 | 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 | 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 -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue