Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jul 31, 2023
1 parent 51cb0e0 commit 1ffdc61
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions defaultActions.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@ func ActionMultiParts(sep string, callback func(c Context) Action) Action {
// ActionMultiPartsN is like ActionMultiParts but limits the number of parts to `n`.
func ActionMultiPartsN(sep string, n int, callback func(c Context) Action) Action {
return ActionCallback(func(c Context) Action {
if n == 0 { // TODO more validation checks
return ActionMessage("invalid value for n: %v", n)
switch n {
case 0:
return ActionMessage("invalid value for n [ActionValuesDescribed]: %v", n)
case 1:
return callback(c).Invoke(c).ToA()
}

splitted := strings.SplitN(c.Value, sep, n)
Expand Down Expand Up @@ -252,12 +255,6 @@ func ActionMultiPartsN(sep string, n int, callback func(c Context) Action) Actio
}
}

LOG.Println("-----")
LOG.Printf("splitted: %#v", splitted)
LOG.Printf("c.Parts: %#v", c.Parts)
LOG.Printf("c.Value: %#v", c.Value)
LOG.Printf("prefix: %#v", prefix)

nospace := '*'
if runes := []rune(sep); len(runes) > 0 {
nospace = runes[len(runes)-1]
Expand Down

0 comments on commit 1ffdc61

Please sign in to comment.