mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-13 08:03:33 +02:00
Add 'pctOf' and 'fit' template functions
This commit is contained in:
@@ -76,6 +76,9 @@ func TemplateProcessor() *template.Template {
|
|||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
},
|
},
|
||||||
|
"fit": func(size int, content string) string {
|
||||||
|
return fmt.Sprintf(fmt.Sprintf("%%-%d.%ds", size, size), content)
|
||||||
|
},
|
||||||
"shellquote": func(content string) string {
|
"shellquote": func(content string) string {
|
||||||
return shellquote.Join(content)
|
return shellquote.Join(content)
|
||||||
},
|
},
|
||||||
@@ -106,6 +109,9 @@ func TemplateProcessor() *template.Template {
|
|||||||
}
|
}
|
||||||
return 120
|
return 120
|
||||||
},
|
},
|
||||||
|
"pctOf": func(size, percent int) int {
|
||||||
|
return int(float32(size) * (float32(percent) / 100))
|
||||||
|
},
|
||||||
"sub": func(a, b int) int {
|
"sub": func(a, b int) int {
|
||||||
return a - b
|
return a - b
|
||||||
},
|
},
|
||||||
@@ -354,7 +360,7 @@ const defaultEditTemplate = `{{/* edit template */ -}}
|
|||||||
# issue: {{ .key }} - created: {{ .fields.created | age}} ago
|
# issue: {{ .key }} - created: {{ .fields.created | age}} ago
|
||||||
update:
|
update:
|
||||||
comment:
|
comment:
|
||||||
- add:
|
- add:
|
||||||
body: |~
|
body: |~
|
||||||
{{ or .overrides.comment "" | indent 10 }}
|
{{ or .overrides.comment "" | indent 10 }}
|
||||||
fields:
|
fields:
|
||||||
@@ -484,7 +490,7 @@ const defaultTransitionTemplate = `{{/* transition template */ -}}
|
|||||||
{{- if .meta.fields.comment }}
|
{{- if .meta.fields.comment }}
|
||||||
update:
|
update:
|
||||||
comment:
|
comment:
|
||||||
- add:
|
- add:
|
||||||
body: |~
|
body: |~
|
||||||
{{ or .overrides.comment "" | indent 10 }}
|
{{ or .overrides.comment "" | indent 10 }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user