Skip to content

Commit 721a4e7

Browse files
authored
fix(carapace example): update invariant (#2082)
Using previous invariant can sometimes be incorrect. See: https://github.com/carapace-sh/carapace/blob/09b28a62d9ce4acbade91bc967cee173454407c1/internal/common/message.go#L92-L114
1 parent c02a0dc commit 721a4e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cookbook/external_completers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The solution to this involves manually checking the value to filter it out:
9595
let carapace_completer = {|spans: list<string>|
9696
carapace $spans.0 nushell ...$spans
9797
| from json
98-
| if ($in | default [] | where value == $"($spans | last)ERR" | is-empty) { $in } else { null }
98+
| if ($in | default [] | any {|| $in.display | str starts-with "ERR"}) { null } else { $in }
9999
}
100100
```
101101

@@ -109,7 +109,7 @@ let fish_completer = ...
109109
let carapace_completer = {|spans: list<string>|
110110
carapace $spans.0 nushell ...$spans
111111
| from json
112-
| if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
112+
| if ($in | default [] | any {|| $in.display | str starts-with "ERR"}) { null } else { $in }
113113
}
114114
115115
# This completer will use carapace by default

0 commit comments

Comments
 (0)