Skip to content

Commit

Permalink
Improve workaround for carapace ERR output (#1159)
Browse files Browse the repository at this point in the history
In case of an unknown flag somewhere in the span, carapace outputs the last element of
the span followed by the string "ERR". If the flag itself is not the last element,
the regex won't match the error message. Instead, check the exact expected value.
  • Loading branch information
stfacc authored Nov 29, 2023
1 parent c6294e1 commit 6e4ef04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cookbook/external_completers.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The solution to this involves manually checking the value to filter it out:
let carapace_completer = {|spans: list<string>|
carapace $spans.0 nushell $spans
| from json
| if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
| if ($in | default [] | where value == $"($spans | last)ERR" | is-empty) { $in } else { null }
}
```

Expand Down

0 comments on commit 6e4ef04

Please sign in to comment.