Skip to content

Commit

Permalink
add regexReplace template function
Browse files Browse the repository at this point in the history
  • Loading branch information
heilig committed Oct 19, 2017
1 parent 28d92eb commit d3e294e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jiracli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -131,6 +132,10 @@ func TemplateProcessor() *template.Template {
"color": func(color string) string {
return ansi.ColorCode(color)
},
"regReplace": func(search string, replace string, content string) string {
re := regexp.MustCompile(search)
return re.ReplaceAllString(content, replace)
},
"split": func(sep string, content string) []string {
return strings.Split(content, sep)
},
Expand Down

0 comments on commit d3e294e

Please sign in to comment.