Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiPartsP: remove context #859

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (a Action) MultiParts(dividers ...string) Action {
}

// MultiPartsP is like MultiParts but with placeholder completion.
func (a Action) MultiPartsP(delimiter string, placeholderPattern string, f func(segment string, matches map[string]string, c Context) Action) Action {
func (a Action) MultiPartsP(delimiter string, placeholderPattern string, f func(segment string, matches map[string]string) Action) Action {
return ActionCallback(func(c Context) Action {
invoked := a.Invoke(c)

Expand Down Expand Up @@ -171,7 +171,7 @@ func (a Action) MultiPartsP(delimiter string, placeholderPattern string, f func(
actions := make([]Action, 0, len(matchedSegments))
for key, value := range matchedSegments {
if placeholder.MatchString(key) {
actions = append(actions, f(key, matchedData, c))
actions = append(actions, f(key, matchedData))
} else {
actions = append(actions, ActionStyledValuesDescribed(key, value.Description, value.Style)) // TODO tag,..
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/carapace/action/multiPartsP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ carapace.ActionStyledValuesDescribed(
"styles/<style>", "details", style.Default,
"styles/custom", "custom style", style.Of(style.Blue, style.Blink),
"styles", "list", style.Yellow,
).MultiPartsP("/", "<.*>", func(segment string, matches map[string]string, c carapace.Context) carapace.Action {
).MultiPartsP("/", "<.*>", func(segment string, matches map[string]string) carapace.Action {
switch segment {
case "<style>":
return carapace.ActionStyles()
Expand Down
2 changes: 1 addition & 1 deletion example/cmd/modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func init() {
"styles/<style>", "details", style.Default,
"styles/custom", "custom style", style.Of(style.Blue, style.Blink),
"styles", "list", style.Yellow,
).MultiPartsP("/", "<.*>", func(segment string, matches map[string]string, c carapace.Context) carapace.Action {
).MultiPartsP("/", "<.*>", func(segment string, matches map[string]string) carapace.Action {
switch segment {
case "<style>":
return carapace.ActionStyles()
Expand Down
Loading