mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
refactor(template): rename files
This commit is contained in:
parent
d5c34b58da
commit
eef50268a9
19
src/template/func_map.go
Normal file
19
src/template/func_map.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package template
|
||||||
|
|
||||||
|
import (
|
||||||
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/Masterminds/sprig/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func funcMap() template.FuncMap {
|
||||||
|
funcMap := map[string]interface{}{
|
||||||
|
"secondsRound": secondsRound,
|
||||||
|
}
|
||||||
|
for key, fun := range sprig.TxtFuncMap() {
|
||||||
|
if _, ok := funcMap[key]; !ok {
|
||||||
|
funcMap[key] = fun
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return template.FuncMap(funcMap)
|
||||||
|
}
|
|
@ -4,23 +4,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
|
||||||
|
|
||||||
"github.com/Masterminds/sprig/v3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func funcMap() template.FuncMap {
|
|
||||||
funcMap := map[string]interface{}{
|
|
||||||
"secondsRound": secondsRound,
|
|
||||||
}
|
|
||||||
for key, fun := range sprig.TxtFuncMap() {
|
|
||||||
if _, ok := funcMap[key]; !ok {
|
|
||||||
funcMap[key] = fun
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return template.FuncMap(funcMap)
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseSeconds(seconds interface{}) (int, error) {
|
func parseSeconds(seconds interface{}) (int, error) {
|
||||||
switch seconds := seconds.(type) {
|
switch seconds := seconds.(type) {
|
||||||
default:
|
default:
|
Loading…
Reference in a new issue