providers: Add path functions to supplement sprig's
This commit is contained in:
29
providers/path/path.go
Normal file
29
providers/path/path.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package path
|
||||
|
||||
import "path"
|
||||
// import "strings"
|
||||
import "html/template"
|
||||
import "git.tebibyte.media/sashakoshka/step"
|
||||
|
||||
var _ step.FuncProvider = new(Provider)
|
||||
|
||||
// Provider provides path functions.
|
||||
type Provider struct {
|
||||
|
||||
}
|
||||
|
||||
// FuncMap fulfills the step.FuncProvider interface.
|
||||
func (this *Provider) FuncMap () template.FuncMap {
|
||||
return template.FuncMap {
|
||||
"joinPaths": funcJoinPaths,
|
||||
"osJoinPaths": funcOSJoinPaths,
|
||||
}
|
||||
}
|
||||
|
||||
func funcJoinPaths (left, right string) string {
|
||||
return path.Join(left, right)
|
||||
}
|
||||
|
||||
func funcOSJoinPaths (left, right string) string {
|
||||
return path.Join(left, right)
|
||||
}
|
||||
Reference in New Issue
Block a user