providers: Add path functions to supplement sprig's
This commit is contained in:
parent
30323c0d59
commit
e7e31f0e60
@ -3,6 +3,7 @@ package providers
|
||||
import "git.tebibyte.media/sashakoshka/step"
|
||||
import fpos "git.tebibyte.media/sashakoshka/step/providers/os"
|
||||
import fphttp "git.tebibyte.media/sashakoshka/step/providers/http"
|
||||
import fppath "git.tebibyte.media/sashakoshka/step/providers/path"
|
||||
import fpsprig "git.tebibyte.media/sashakoshka/step/providers/sprig"
|
||||
import fpimport "git.tebibyte.media/sashakoshka/step/providers/import"
|
||||
import fpmarkdown "git.tebibyte.media/sashakoshka/step/providers/markdown"
|
||||
@ -12,6 +13,7 @@ func All () []step.FuncProvider {
|
||||
return []step.FuncProvider {
|
||||
new(fpos.Provider),
|
||||
new(fphttp.Provider),
|
||||
new(fppath.Provider),
|
||||
new(fpsprig.Provider),
|
||||
new(fpimport.Provider),
|
||||
fpmarkdown.Default(),
|
||||
|
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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user