aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/state.go')
-rw-r--r--internal/rosa/state.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index 2581bb75..90da8660 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -451,6 +451,30 @@ func (s *S) getFrame() azalea.Frame {
return
}},
+ k("split"): {F: func(
+ args azalea.FArgs,
+ ) (v any, set bool, err error) {
+ var p, sep string
+ var n int64
+ if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
+ k("s"): &p,
+ k("sep"): &sep,
+ k("n"): &n,
+ }); err != nil {
+ return
+ }
+
+ if n < 0 {
+ n = 0
+ } else if n == 0 {
+ n = -1
+ }
+
+ v = strings.SplitN(p, sep, int(n))
+ set = true
+ return
+ }},
+
// intenral/pkg built-ins
k("remoteTar"): {F: func(