Working now
This commit is contained in:
parent
65c1b039cc
commit
de3bdec567
|
@ -257,14 +257,14 @@ func funcGenVault(ctx *Context) interface{} {
|
|||
}
|
||||
|
||||
func funcGenSed(ctx *Context) interface{} {
|
||||
return func(k string, expr string) (string, error) {
|
||||
engine, err := sed.NewQuiet(strings.NewReader(expr))
|
||||
return func(inputString string, expression string) (string, error) {
|
||||
engine, err := sed.New(strings.NewReader(expression))
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result, err := engine.RunString(k)
|
||||
result, err := engine.RunString(inputString)
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
|
|
@ -322,17 +322,17 @@ func TestFuncSed(t *testing.T) {
|
|||
Output string
|
||||
}{
|
||||
{
|
||||
`{{sed "hello" "s/hello/world/"}}`,
|
||||
`{{sed "hello" "s|hello|world|"}}`,
|
||||
`world`,
|
||||
},
|
||||
|
||||
{
|
||||
`{{sed "hello" "s/foo/bar/"}}`,
|
||||
`{{sed "hello" "s|foo|bar|"}}`,
|
||||
`hello`,
|
||||
},
|
||||
|
||||
{
|
||||
`{{user "foo" | sed "s/foo/bar/"}}`,
|
||||
`{{user "foo" | sed "s|foo|bar|"}}`,
|
||||
`bar`,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue