1
0
mirror of https://github.com/go-task/task.git synced 2025-02-03 13:22:11 +02:00

feat: add spew function to templater (#1452)

This commit is contained in:
Pete Davison 2024-01-11 01:04:45 +00:00 committed by GitHub
parent d797836cb8
commit 00896a1318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

2
go.mod
View File

@ -4,6 +4,7 @@ go 1.20
require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/davecgh/go-spew v1.1.1
github.com/fatih/color v1.16.0
github.com/go-task/slim-sprig/v3 v3.0.0
github.com/joho/godotenv v1.5.1
@ -22,7 +23,6 @@ require (
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect

View File

@ -9,6 +9,8 @@ import (
"mvdan.cc/sh/v3/shell"
"mvdan.cc/sh/v3/syntax"
"github.com/davecgh/go-spew/spew"
sprig "github.com/go-task/slim-sprig/v3"
)
@ -52,6 +54,9 @@ func init() {
"relPath": func(basePath, targetPath string) (string, error) {
return filepath.Rel(basePath, targetPath)
},
"spew": func(v any) string {
return spew.Sdump(v)
},
}
// Deprecated aliases for renamed functions.
taskFuncs["FromSlash"] = taskFuncs["fromSlash"]