This repository was archived by the owner on Oct 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +44
-1
lines changed Expand file tree Collapse file tree 5 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ Returns an instance of Golang [Time](https://golang.org/pkg/time/#Time).
12
12
13
13
Parses specified string using RFC3339 layout. Returns an instance of Golang [ Time] ( https://golang.org/pkg/time/#Time ) .
14
14
15
+ ### ** strings**
16
+ String related functions.
17
+
18
+ <hr >
19
+ ** ` strings.ReplaceAll() string ` **
20
+
21
+ Executes function built-in Golang [ strings.ReplaceAll] ( https://pkg.go.dev/strings#ReplaceAll ) function.
22
+
15
23
### ** repo**
16
24
Functions that provide additional information about Application source repository.
17
25
<hr >
@@ -52,4 +60,4 @@ Returns application details. `AppDetail` fields:
52
60
* ` GetFileParameterPathByName(Name string) ` Retrieve path by name in FileParameters field
53
61
* ` Ksonnet *apiclient.KsonnetAppSpec ` - Ksonnet details
54
62
* ` Kustomize *apiclient.KustomizeAppSpec ` - Kustomize details
55
- * ` Directory *apiclient.DirectoryAppSpec ` - Directory details
63
+ * ` Directory *apiclient.DirectoryAppSpec ` - Directory details
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package expr
2
2
3
3
import (
4
4
"github.com/argoproj-labs/argocd-notifications/expr/repo"
5
+ "github.com/argoproj-labs/argocd-notifications/expr/strings"
5
6
"github.com/argoproj-labs/argocd-notifications/expr/time"
6
7
"github.com/argoproj-labs/argocd-notifications/shared/argocd"
7
8
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -12,6 +13,7 @@ var helpers = map[string]interface{}{}
12
13
func init () {
13
14
helpers = make (map [string ]interface {})
14
15
register ("time" , time .NewExprs ())
16
+ register ("strings" , strings .NewExprs ())
15
17
}
16
18
17
19
func register (namespace string , entry map [string ]interface {}) {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ func TestExpr(t *testing.T) {
10
10
namespaces := []string {
11
11
"time" ,
12
12
"repo" ,
13
+ "strings" ,
13
14
}
14
15
15
16
for _ , ns := range namespaces {
Original file line number Diff line number Diff line change
1
+ package strings
2
+
3
+ import "strings"
4
+
5
+ func NewExprs () map [string ]interface {} {
6
+ return map [string ]interface {}{
7
+ "ReplaceAll" : replaceAll ,
8
+ }
9
+ }
10
+
11
+ func replaceAll (s , old , new string ) string {
12
+ return strings .ReplaceAll (s , old , new )
13
+ }
Original file line number Diff line number Diff line change
1
+ package strings
2
+
3
+ import (
4
+ "testing"
5
+
6
+ "github.com/stretchr/testify/assert"
7
+ )
8
+
9
+ func TestNewExprs (t * testing.T ) {
10
+ funcs := []string {
11
+ "ReplaceAll" ,
12
+ }
13
+
14
+ for _ , fn := range funcs {
15
+ stringsExprs := NewExprs ()
16
+ _ , hasFunc := stringsExprs [fn ]
17
+ assert .True (t , hasFunc )
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments