mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-15 11:56:56 +02:00
feat: add split tmpl function (#3293)
This commit is contained in:
parent
d6306059d2
commit
42eaf083fe
@ -176,6 +176,7 @@ func (t *Template) Apply(s string) (string, error) {
|
|||||||
Option("missingkey=error").
|
Option("missingkey=error").
|
||||||
Funcs(template.FuncMap{
|
Funcs(template.FuncMap{
|
||||||
"replace": strings.ReplaceAll,
|
"replace": strings.ReplaceAll,
|
||||||
|
"split": strings.Split,
|
||||||
"time": func(s string) string {
|
"time": func(s string) string {
|
||||||
return time.Now().UTC().Format(s)
|
return time.Now().UTC().Format(s)
|
||||||
},
|
},
|
||||||
|
@ -96,6 +96,7 @@ On all fields, you have these available functions:
|
|||||||
| Usage | Description |
|
| Usage | Description |
|
||||||
|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `replace "v1.2" "v" ""` | replaces all matches. See [ReplaceAll](https://golang.org/pkg/strings/#ReplaceAll) |
|
| `replace "v1.2" "v" ""` | replaces all matches. See [ReplaceAll](https://golang.org/pkg/strings/#ReplaceAll) |
|
||||||
|
| `split "1.2" "."` | split string at separator. See [Split](https://golang.org/pkg/strings/#Split) |
|
||||||
| `time "01/02/2006"` | current UTC time in the specified format (this is not deterministic, a new time for every call) |
|
| `time "01/02/2006"` | current UTC time in the specified format (this is not deterministic, a new time for every call) |
|
||||||
| `tolower "V1.2"` | makes input string lowercase. See [ToLower](https://golang.org/pkg/strings/#ToLower) |
|
| `tolower "V1.2"` | makes input string lowercase. See [ToLower](https://golang.org/pkg/strings/#ToLower) |
|
||||||
| `toupper "v1.2"` | makes input string uppercase. See [ToUpper](https://golang.org/pkg/strings/#ToUpper) |
|
| `toupper "v1.2"` | makes input string uppercase. See [ToUpper](https://golang.org/pkg/strings/#ToUpper) |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user